Jose Luis Pedrosa created CAMEL-9835:
----------------------------------------

             Summary: Enable  kafka consumer to subcribe to multiple topics
                 Key: CAMEL-9835
                 URL: https://issues.apache.org/jira/browse/CAMEL-9835
             Project: Camel
          Issue Type: Wish
          Components: camel-kafka
    Affects Versions: 2.17.0
         Environment: Any
            Reporter: Jose Luis Pedrosa
            Priority: Minor
             Fix For: 2.17.1


Kafka supports that one consumer is subcriber to multple topics. In their api 
when you start the consumer you MUST provide an Array of topics.

If we look in /java/org/apache/camel/component/kafka/KafkaConsumer.java
Currently this is the piece of code that starts the subscriber:
{code}
LOG.debug("Subscribing {} to topic {}", threadId, topicName);
consumer.subscribe(Arrays.asList(topicName));
{code}

just simply allowing the comma separated topic syntax and replacing one line of 
code (and the documentation) it would be working.
{code}
LOG.debug("Subscribing {} to topic {}", threadId, topicName);
consumer.subscribe(Arrays.asList(topicName.split(",")));
{code}

Despite the same could be achieved by adding more consumers (rotues) this 
causes a significant amount of load (because of the commits) to kafka, so this 
really helps to improve performance. 

the topic has been already marked as mandatory, so that should keep the 
nullpointer safe.

@UriParam @Metadata(required = "true")
private String topic;

thanks!



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

Reply via email to