Java Magazine, Jan/Feb 2018
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2018 85 beyond CRUD public class EventConsumer implements Runnable private KafkaConsumer String CoffeeEvent consumer private final Consumer CoffeeEvent eventConsumer private final AtomicBoolean closed new AtomicBoolean public EventConsumer Properties kafkaProperties Consumer CoffeeEvent eventConsumer String topics this eventConsumer eventConsumer consumer new KafkaConsumer kafkaProperties consumer subscribe asList topics @ Override public void run try while closed get consume catch WakeupException e will wake up for closing finally consumer close private void consume ConsumerRecords String CoffeeEvent records consumer poll Long MAX_ VALUE
You must have JavaScript enabled to view digital editions.