[ 
https://issues.apache.org/jira/browse/CAMEL-9823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263604#comment-15263604
 ] 

Andrea Cosentino commented on CAMEL-9823:
-----------------------------------------

Hi [~anbumani.balusamy],

I'm reviewing the code.

It seems you're not using the ConsumerLoop that is used in Kafka Consumer 
Groups.

{code}
public static void main(String[] args) { 
  int numConsumers = 3;
  String groupId = "consumer-tutorial-group"
  List<String> topics = Arrays.asList("consumer-tutorial");
  ExecutorService executor = Executors.newFixedThreadPool(numConsumers);

  final List<ConsumerLoop> consumers = new ArrayList<>();
  for (int i = 0; i < numConsumers; i++) {
    ConsumerLoop consumer = new ConsumerLoop(i, groupId, topics);
    consumers.add(consumer);
    executor.submit(consumer);
  }

  Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
      for (ConsumerLoop consumer : consumers) {
        consumer.shutdown();
      } 
      executor.shutdown();
      try {
        executor.awaitTermination(5000, TimeUnit.MILLISECONDS);
      } catch (InterruptedException e) {
        e.printStackTrace;
      }
    }
  });
}
{code}

> Exploring Consumer groups feature in Camel-kafka consumer side
> --------------------------------------------------------------
>
>                 Key: CAMEL-9823
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9823
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-kafka
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>             Fix For: 2.18.0
>
>         Attachments: KafkaConsumer.java
>
>
> I guess we can take advantage from consumer groups feature in camel-kafka.
> http://www.confluent.io/blog/tutorial-getting-started-with-the-new-apache-kafka-0.9-consumer-client



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to