class ConsumersStatistics(val id: String, val timerPeriod: Int, val logLevel: Level) extends TimerTask
Build and publish the statistics for the consumers in the form of log messages.
The ConsumersStatistics collects the number of events read from the topics and periodically publish log messages with the statistics. The period to collect data and publish statistics and the log level to use are customizable.
ConsumersStatistics.start must be invoked to activate the timer task that periodically publishes the logs. ConsumersStatistics.stop) must be invoked to stop publishing the statistics. Once stopped the ConsumersStatistics cannot be started again.
In case of overflow incrementing the number of the events read from the topics, the numbers are reset to 0. For synchronization, ConsumersStatistics uses AtomicLong whose values are reset to 0 when there is an overflow. The operation of (increase -> checkOverflow -> reset) is not atomic so it could happen that the statistics are not reporting useful values in that case but such event is so rare that it is not worst to add more complexity.
Value parameters
id
The id for the consumer
logLevel:
the level of the logs published for the statistics