import java.time.Duration;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
@Slf4j
private final Thread workerThread;
private final Runnable closeCallback;
+ private final Map<Integer, Long> counterState = new HashMap<>();
+
private volatile boolean running = false;
private long consumed = 0;
{
consumed++;
log.info("{} - {}: {}/{} - {}={}", id, offset, topic, partition, key, value);
+ Integer counted = Integer.parseInt(key);
+ Long counter = counterState.compute(counted, (k, v) -> v == null ? 1l : v + 1);
+ log.info("{} - current value for counter {}: {}", id, counted, counter);
}