Fwd: Camel-kafka integration issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Camel-kafka integration issue

Sanu Sandesh
Team,

I am trying to integrate Camel with Kafka. Written simple application with
camelcontext initialized in main() program & added my routebuilder with
below code:

 from("direct:start")
                .setBody(constant("Message from Camel")) // Message to send
                .setHeader(KafkaConstants.KEY, constant("Camel")) // Key of
the message
                .to("kafka:test?brokers=localhost:2181");

where my topic is : test

This code not sending message to my kafka consumer. where as plain kafka
code is sending. I am trying to see consumer using CLI.

Need assistance pls.

REgards,
Sandesh
Reply | Threaded
Open this post in threaded view
|

Re: Camel-kafka integration issue

Andrea Cosentino-3
You need to send something to direct. As it is you're not sending messages
to your route.

Use a timer.

Il giorno mar 31 mar 2020 alle ore 14:18 Sanu Sandesh <
[hidden email]> ha scritto:

> Team,
>
> I am trying to integrate Camel with Kafka. Written simple application with
> camelcontext initialized in main() program & added my routebuilder with
> below code:
>
>  from("direct:start")
>                 .setBody(constant("Message from Camel")) // Message to send
>                 .setHeader(KafkaConstants.KEY, constant("Camel")) // Key of
> the message
>                 .to("kafka:test?brokers=localhost:2181");
>
> where my topic is : test
>
> This code not sending message to my kafka consumer. where as plain kafka
> code is sending. I am trying to see consumer using CLI.
>
> Need assistance pls.
>
> REgards,
> Sandesh
>
Reply | Threaded
Open this post in threaded view
|

Re: Camel-kafka integration issue

Omar Al-Safi
You can take a look at this example
<https://github.com/apache/camel-examples/tree/master/examples/camel-example-kafka>
which
explains this in good details.

Regards,
Omar

On Tue, Mar 31, 2020 at 2:20 PM Andrea Cosentino <[hidden email]> wrote:

> You need to send something to direct. As it is you're not sending messages
> to your route.
>
> Use a timer.
>
> Il giorno mar 31 mar 2020 alle ore 14:18 Sanu Sandesh <
> [hidden email]> ha scritto:
>
> > Team,
> >
> > I am trying to integrate Camel with Kafka. Written simple application
> with
> > camelcontext initialized in main() program & added my routebuilder with
> > below code:
> >
> >  from("direct:start")
> >                 .setBody(constant("Message from Camel")) // Message to
> send
> >                 .setHeader(KafkaConstants.KEY, constant("Camel")) // Key
> of
> > the message
> >                 .to("kafka:test?brokers=localhost:2181");
> >
> > where my topic is : test
> >
> > This code not sending message to my kafka consumer. where as plain kafka
> > code is sending. I am trying to see consumer using CLI.
> >
> > Need assistance pls.
> >
> > REgards,
> > Sandesh
> >
>