Code example for AtomicInteger

Methods: incrementAndGet

0
public class ExampleConsumerMessageFilter implements ConsumerMessageFilter { 
 
    AtomicInteger counter = new AtomicInteger(0);
    @Override 
    public boolean accept(String group, Message message) {
        return this.counter.incrementAndGet() % 2 == 0;
    } 
 
}