Hi all,

In our application, we are currently starting a Kafka Consumer with the
following lines of code:

connector = Consumer.createJavaConsumerConnector(consumerConfig);
streams = connector .createMessageStreams(map);

Then, each KafkaStream is processed in a dedicated thread per topic and
partition, as documented here
https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example

We need to stop (halt) and restart the consumer. Today, we just call:

connector.shutdown()

and wait for threads to terminate.

To restart the consumer, we create a new connector:

connector = Consumer.createJavaConsumerConnector(consumerConfig);

When restarting is complete, I can see that a JMX MBean (we  use Metrics
JMXReporter) like "ZookeeperConsumerConnector" is registered twice. This
bean is not registered when the previous connector instance is shut down.

What is the best way to stop/halt and restart a Consumer using the Java API?

Is it normal that the MBean is not unregistered at shutdown time?

Thanks,

-- Tanguy

Reply via email to