test_class.declarator: TOPIC = "foo"
test_class.modifier: private final
test_class.original_string: private final String TOPIC = "foo";
test_class.type: String
test_class.var_name: TOPIC
test_class.declarator: zooKeeper = new EmbeddedZooKeeper()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public EmbeddedZooKeeper zooKeeper = new EmbeddedZooKeeper();
test_class.type: EmbeddedZooKeeper
test_class.var_name: zooKeeper
test_class.declarator: broker = EmbeddedKafkaBroker.builder()
              .zookeeperConnect("127.0.0.1:" + zooKeeper.getPort())
              .numPartitions(3)
              .build()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public EmbeddedKafkaBroker broker = EmbeddedKafkaBroker.builder()
              .zookeeperConnect("127.0.0.1:" + zooKeeper.getPort())
              .numPartitions(3)
              .build();
test_class.type: EmbeddedKafkaBroker
test_class.var_name: broker
test_class.file: kafka/kafka-listener/src/test/java/com/ameliant/tools/kafka/listener/KafkaMessageListenerContainerTest.java
test_class.identifier: KafkaMessageListenerContainerTest
test_case.body: @Test
      public void testReceive_errorHandling() throws Exception {
          int messagesToSend = 1000;
          preloadTopic(TOPIC, messagesToSend);
  
          Properties configs = props(getConsumerConfigs());
          AtomicInteger messagesReceived = new AtomicInteger();
          AtomicInteger exceptionsHandled = new AtomicInteger();
  
          CountDownLatch latch = new CountDownLatch(messagesToSend);
  
          MemoryOffsetStore offsetStore = new MemoryOffsetStore();
  
          KafkaMessageListenerContainer.Builder<byte[], byte[]> builder = new KafkaMessageListenerContainer.Builder<byte[], byte[]>()
                  .kafkaConfig(configs)
                  .offsetStore(offsetStore)
                  .topic(TOPIC)
                  .messageListener((key, value) -> {
                      try {
                          if (messagesReceived.incrementAndGet() == 500) {
                              throw new IllegalArgumentException("Boom!");
                          }
                      } finally {
                          latch.countDown();
                      }
                  })
                  .exceptionHandler((tuple, exception) -> {
                      exceptionsHandled.incrementAndGet();
                      assertTrue(exception instanceof IllegalArgumentException);
                  });
  
          try (KafkaMessageListenerContainer<byte[], byte[]> container = builder.build()) {
              container.init();
              if (!latch.await(10, TimeUnit.SECONDS)) {
                  fail("Timeout expired waiting on latch");
              }
  
              assertEquals(messagesToSend, messagesReceived.get());
              assertEquals(1, exceptionsHandled.get());
          }
      }
test_case.class_method_signature: KafkaMessageListenerContainerTest.testReceive_errorHandling()
test_case.full_signature: @Test public void testReceive_errorHandling()
test_case.identifier: testReceive_errorHandling
test_case.invocations: preloadTopic props getConsumerConfigs exceptionHandler messageListener topic offsetStore kafkaConfig incrementAndGet countDown incrementAndGet assertTrue build init await fail assertEquals get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReceive_errorHandling()
focal_class.declarator: DEFAULT_POLL_TIMEOUT = 100
focal_class.modifier: public static final
focal_class.original_string: public static final int DEFAULT_POLL_TIMEOUT = 100;
focal_class.type: int
focal_class.var_name: DEFAULT_POLL_TIMEOUT
focal_class.declarator: log = LoggerFactory.getLogger(this.getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger log = LoggerFactory.getLogger(this.getClass());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: kafkaConfig
focal_class.modifier: private final
focal_class.original_string: private final Properties kafkaConfig;
focal_class.type: Properties
focal_class.var_name: kafkaConfig
focal_class.declarator: groupId
focal_class.modifier: private final
focal_class.original_string: private final String groupId;
focal_class.type: String
focal_class.var_name: groupId
focal_class.declarator: offsetStore
focal_class.modifier: private final
focal_class.original_string: private final OffsetStore offsetStore;
focal_class.type: OffsetStore
focal_class.var_name: offsetStore
focal_class.declarator: topic
focal_class.modifier: private final
focal_class.original_string: private final String topic;
focal_class.type: String
focal_class.var_name: topic
focal_class.declarator: messageListener
focal_class.modifier: private final
focal_class.original_string: private final BiConsumer<K, V> messageListener;
focal_class.type: BiConsumer<K, V>
focal_class.var_name: messageListener
focal_class.declarator: recordsProcessed = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong recordsProcessed = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: recordsProcessed
focal_class.declarator: exceptionHandler =
              (tuple, ex) -> log.error("Caught exception: {}", ex)
focal_class.modifier: private
focal_class.original_string: private BiConsumer<Tuple2<K, V>, Exception> exceptionHandler =
              (tuple, ex) -> log.error("Caught exception: {}", ex);
focal_class.type: BiConsumer<Tuple2<K, V>, Exception>
focal_class.var_name: exceptionHandler
focal_class.declarator: executorService = Executors.newSingleThreadExecutor()
focal_class.modifier: private final
focal_class.original_string: private final ExecutorService executorService = Executors.newSingleThreadExecutor();
focal_class.type: ExecutorService
focal_class.var_name: executorService
focal_class.declarator: workerShutdownLatch = new CountDownLatch(1)
focal_class.modifier: private final
focal_class.original_string: private final CountDownLatch workerShutdownLatch = new CountDownLatch(1);
focal_class.type: CountDownLatch
focal_class.var_name: workerShutdownLatch
focal_class.declarator: assignedTopicPartitions = new CopyOnWriteArraySet()
focal_class.modifier: private final
focal_class.original_string: private final CopyOnWriteArraySet assignedTopicPartitions = new CopyOnWriteArraySet();
focal_class.type: CopyOnWriteArraySet
focal_class.var_name: assignedTopicPartitions
focal_class.declarator: shuttingDown = new AtomicBoolean(false)
focal_class.modifier: private final
focal_class.original_string: private final AtomicBoolean shuttingDown = new AtomicBoolean(false);
focal_class.type: AtomicBoolean
focal_class.var_name: shuttingDown
focal_class.file: kafka/kafka-listener/src/main/java/com/ameliant/tools/kafka/listener/KafkaMessageListenerContainer.java
focal_class.identifier: KafkaMessageListenerContainer
focal_class.interfaces: implements Runnable, AutoCloseable
focal_class.class_method_signature: KafkaMessageListenerContainer.KafkaMessageListenerContainer(Properties kafkaConfig,
                                           OffsetStore offsetStore,
                                           String topic,
                                           BiConsumer<K, V> messageListener)
focal_class.full_signature: public  KafkaMessageListenerContainer(Properties kafkaConfig,
                                           OffsetStore offsetStore,
                                           String topic,
                                           BiConsumer<K, V> messageListener)
focal_class.identifier: KafkaMessageListenerContainer
focal_class.modifiers: public
focal_class.parameters: (Properties kafkaConfig,
                                           OffsetStore offsetStore,
                                           String topic,
                                           BiConsumer<K, V> messageListener)
focal_class.signature:  KafkaMessageListenerContainer(Properties kafkaConfig,
                                           OffsetStore offsetStore,
                                           String topic,
                                           BiConsumer<K, V> messageListener)
focal_class.class_method_signature: KafkaMessageListenerContainer.setExceptionHandler(BiConsumer<Tuple2<K, V>, Exception> exceptionHandler)
focal_class.full_signature: public void setExceptionHandler(BiConsumer<Tuple2<K, V>, Exception> exceptionHandler)
focal_class.identifier: setExceptionHandler
focal_class.modifiers: public
focal_class.parameters: (BiConsumer<Tuple2<K, V>, Exception> exceptionHandler)
focal_class.return: void
focal_class.signature: void setExceptionHandler(BiConsumer<Tuple2<K, V>, Exception> exceptionHandler)
focal_class.class_method_signature: KafkaMessageListenerContainer.init()
focal_class.full_signature: public void init()
focal_class.identifier: init
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: KafkaMessageListenerContainer.run()
focal_class.full_signature: @Override public void run()
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void run()
focal_class.class_method_signature: KafkaMessageListenerContainer.createConsumer(Properties kafkaConfig)
focal_class.full_signature: private KafkaConsumer createConsumer(Properties kafkaConfig)
focal_class.identifier: createConsumer
focal_class.modifiers: private
focal_class.parameters: (Properties kafkaConfig)
focal_class.return: KafkaConsumer
focal_class.signature: KafkaConsumer createConsumer(Properties kafkaConfig)
focal_class.class_method_signature: KafkaMessageListenerContainer.pollingLoop(Consumer consumer, String groupId)
focal_class.full_signature: private void pollingLoop(Consumer consumer, String groupId)
focal_class.identifier: pollingLoop
focal_class.modifiers: private
focal_class.parameters: (Consumer consumer, String groupId)
focal_class.return: void
focal_class.signature: void pollingLoop(Consumer consumer, String groupId)
focal_class.class_method_signature: KafkaMessageListenerContainer.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: KafkaMessageListenerContainer.getRecordsProcessed()
focal_class.full_signature: public long getRecordsProcessed()
focal_class.identifier: getRecordsProcessed
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getRecordsProcessed()
focal_method.body: public void init() {
          executorService.submit(this);
      }
focal_method.class_method_signature: KafkaMessageListenerContainer.init()
focal_method.full_signature: public void init()
focal_method.identifier: init
focal_method.invocations: submit
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void init()