You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "web_nabble@sunilsamuel.com" <we...@sunilsamuel.com> on 2015/12/23 13:51:37 UTC
Camel Kafka Component as a Consumer within a Route
Hello,
I am trying to use the kafka component as a consumer from within a route.
For instance,
from("timer://foo?fixedRate=true&period=60000")
/* Use Kafka to consumer message */
.setHeader("kafka.OFFSET",constant("0"))
.to("kafka:192.168.111.54:9092?topic=test&"+
"zookeeperHost=192.168.111.54&zookeeperPort=2181&"+
"groupId=groupBatch&consumerId=100")
.to("log:input ${body}");
But at this point, the way that I am using it, the kafka component becomes a
producer. Is there a way to consume from within a route?
thanks,
sunil.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Kafka-Component-as-a-Consumer-within-a-Route-tp5775404.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Camel Kafka Component as a Consumer within a Route
Posted by "web_nabble@sunilsamuel.com" <we...@sunilsamuel.com>.
Hello,
Yes. Thank you. We are able to do this with PollEnrich. The following
route is modified:
from("timer://foo?fixedRate=true&period=10000")
.setBody().constant("test")
.setHeader("kafka.OFFSET",constant("smallest"))
.pollEnrich("kafka:192.168.111.54:9092?topic=test&"+
"zookeeperHost=192.168.111.54&zookeeperPort=2181&"+
"groupId=groupBatch",1000)
.log("FROM THE TIMER [${body}]")
;
Thank You,
sunil.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Kafka-Component-as-a-Consumer-within-a-Route-tp5775404p5775410.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Camel Kafka Component as a Consumer within a Route
Posted by Claus Ibsen <cl...@gmail.com>.
See the content enricher EIP and the pollEnrich
On Wed, Dec 23, 2015 at 1:51 PM, web_nabble@sunilsamuel.com
<we...@sunilsamuel.com> wrote:
> Hello,
>
> I am trying to use the kafka component as a consumer from within a route.
> For instance,
>
> from("timer://foo?fixedRate=true&period=60000")
> /* Use Kafka to consumer message */
> .setHeader("kafka.OFFSET",constant("0"))
> .to("kafka:192.168.111.54:9092?topic=test&"+
> "zookeeperHost=192.168.111.54&zookeeperPort=2181&"+
> "groupId=groupBatch&consumerId=100")
> .to("log:input ${body}");
>
> But at this point, the way that I am using it, the kafka component becomes a
> producer. Is there a way to consume from within a route?
>
> thanks,
> sunil.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Kafka-Component-as-a-Consumer-within-a-Route-tp5775404.html
> Sent from the Camel Development mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2