Kafka component Spring boot auto configuration

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

Kafka component Spring boot auto configuration

Yoshimo
Hello Camel users,

I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:

https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc

and I am trying to set this configuration in my yaml file:
camel.component.kafka.configuration.value-deserializer

However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?

Thank you,
Yiannis
Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Claus Ibsen-2
Hi

What version of Camel, Kafka and SB are you using?

On Tue, Dec 4, 2018 at 8:59 AM Yoshimo <[hidden email]> wrote:

>
> Hello Camel users,
>
> I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
>
> https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
>
> and I am trying to set this configuration in my yaml file:
> camel.component.kafka.configuration.value-deserializer
>
> However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
>
> Thank you,
> Yiannis



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Yoshimo
Hello Claus,

thank you for looking into this.
Camel: 2.23.0
Kafka: 2.0.0
SB: 2.1.0.RELEASE

I am also attaching my pom if you want to have a look.

Thank you,
Yiannis


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, 5 December 2018 12:15, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> What version of Camel, Kafka and SB are you using?
>
> On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
>
> > Hello Camel users,
> > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > and I am trying to set this configuration in my yaml file:
> > camel.component.kafka.configuration.value-deserializer
> > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > Thank you,
> > Yiannis
>
> --
>
> Claus Ibsen
>
> ------------
>
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Yoshimo
In reply to this post by Claus Ibsen-2
Here is what I add to my yaml file:

camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer

and here is my route:

                from("kafka:prices?brokers={{kafka.servers}}")
                                .convertBodyTo(DBModel.class)
                ......

With this setup when I start the app I can see in the logs the Kafka configuration in the consumer:

value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer

and I get exceptions while deserializing. However if I remove the config from the yaml file and update my route to be:

kafka:prices?brokers={{kafka.servers}}&valueDeserializer=com.openbet.platform.pricepublisher.serde.SportsEventDeserializer

then I see the following in the Kafka consumer config:

value.deserializer = class com.openbet.platform.pricepublisher.serde.SportsEventDeserializer

and the app works as expected. Just for reference the rest of my yaml file is:

kafka:
  sportsTopic: sports
  pricesTopic: prices
  servers: localhost:25445
  streams:
    "[application.id]": price-publisher
    "[bootstrap.servers]": ${kafka.servers}
    "[default.key.serde]": com.openbet.platform.pricepublisher.serde.ActivityKeySerDe
    "[default.value.serde]": com.openbet.platform.pricepublisher.serde.ActivityValueSerDe

Thank you,
Yiannis

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, 5 December 2018 13:30, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> Can you post your yaml configuration of how you try to configure this
> kafka value deserializer
> On Wed, Dec 5, 2018 at 11:36 AM Yoshimo [hidden email] wrote:
>
> > Hello Claus,
> > thank you for looking into this.
> > Camel: 2.23.0
> > Kafka: 2.0.0
> > SB: 2.1.0.RELEASE
> > I am also attaching my pom if you want to have a look.
> > Thank you,
> > Yiannis
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > On Wednesday, 5 December 2018 12:15, Claus Ibsen [hidden email] wrote:
> >
> > > Hi
> > > What version of Camel, Kafka and SB are you using?
> > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
> > >
> > > > Hello Camel users,
> > > > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > > > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > > > and I am trying to set this configuration in my yaml file:
> > > > camel.component.kafka.configuration.value-deserializer
> > > > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > > > Thank you,
> > > > Yiannis
> > >
> > > --
> > > Claus Ibsen
> > >
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
>
> --
>
> Claus Ibsen
>
> ------------
>
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Claus Ibsen-2
On Wed, Dec 5, 2018 at 12:56 PM Yoshimo <[hidden email]> wrote:

>
> Here is what I add to my yaml file:
>
> camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
>
> and here is my route:
>
>                 from("kafka:prices?brokers={{kafka.servers}}")
>                                 .convertBodyTo(DBModel.class)
>                 ......
>
> With this setup when I start the app I can see in the logs the Kafka configuration in the consumer:
>
> value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
>

Try with

value.deserializer = org.apache.kafka.common.serialization.StringDeserializer



> and I get exceptions while deserializing. However if I remove the config from the yaml file and update my route to be:
>
> kafka:prices?brokers={{kafka.servers}}&valueDeserializer=com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
>
> then I see the following in the Kafka consumer config:
>
> value.deserializer = class com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
>
> and the app works as expected. Just for reference the rest of my yaml file is:
>
> kafka:
>   sportsTopic: sports
>   pricesTopic: prices
>   servers: localhost:25445
>   streams:
>     "[application.id]": price-publisher
>     "[bootstrap.servers]": ${kafka.servers}
>     "[default.key.serde]": com.openbet.platform.pricepublisher.serde.ActivityKeySerDe
>     "[default.value.serde]": com.openbet.platform.pricepublisher.serde.ActivityValueSerDe
>
> Thank you,
> Yiannis
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, 5 December 2018 13:30, Claus Ibsen <[hidden email]> wrote:
>
> > Hi
> >
> > Can you post your yaml configuration of how you try to configure this
> > kafka value deserializer
> > On Wed, Dec 5, 2018 at 11:36 AM Yoshimo [hidden email] wrote:
> >
> > > Hello Claus,
> > > thank you for looking into this.
> > > Camel: 2.23.0
> > > Kafka: 2.0.0
> > > SB: 2.1.0.RELEASE
> > > I am also attaching my pom if you want to have a look.
> > > Thank you,
> > > Yiannis
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > On Wednesday, 5 December 2018 12:15, Claus Ibsen [hidden email] wrote:
> > >
> > > > Hi
> > > > What version of Camel, Kafka and SB are you using?
> > > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
> > > >
> > > > > Hello Camel users,
> > > > > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > > > > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > > > > and I am trying to set this configuration in my yaml file:
> > > > > camel.component.kafka.configuration.value-deserializer
> > > > > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > > > > Thank you,
> > > > > Yiannis
> > > >
> > > > --
> > > > Claus Ibsen
> > > >
> > > > http://davsclaus.com @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> >
> > --
> >
> > Claus Ibsen
> >
> > ------------
> >
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
>
>


--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Yoshimo
Hey Claus,

I think that you misread my previous email. The value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer line is the logging output of the Kafka consumer being created by Camel when I try adding the Spring Boot configuration.

What I actually add to my yaml file is the following:
camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer

The above is being ignored and the Kafka consumer that gets created by Camel has the default deserialer.

Thank you




‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, 5 December 2018 14:17, Claus Ibsen <[hidden email]> wrote:

> On Wed, Dec 5, 2018 at 12:56 PM Yoshimo [hidden email] wrote:
>
> > Here is what I add to my yaml file:
> > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > and here is my route:
> >
> >                 from("kafka:prices?brokers={{kafka.servers}}")
> >                                 .convertBodyTo(DBModel.class)
> >                 ......
> >
> >
> > With this setup when I start the app I can see in the logs the Kafka configuration in the consumer:
> > value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
>
> Try with
>
> value.deserializer = org.apache.kafka.common.serialization.StringDeserializer
>
> > and I get exceptions while deserializing. However if I remove the config from the yaml file and update my route to be:
> > kafka:prices?brokers={{kafka.servers}}&valueDeserializer=com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > then I see the following in the Kafka consumer config:
> > value.deserializer = class com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > and the app works as expected. Just for reference the rest of my yaml file is:
> > kafka:
> > sportsTopic: sports
> > pricesTopic: prices
> > servers: localhost:25445
> > streams:
> > "[application.id]": price-publisher
> > "[bootstrap.servers]": ${kafka.servers}
> > "[default.key.serde]": com.openbet.platform.pricepublisher.serde.ActivityKeySerDe
> > "[default.value.serde]": com.openbet.platform.pricepublisher.serde.ActivityValueSerDe
> > Thank you,
> > Yiannis
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > On Wednesday, 5 December 2018 13:30, Claus Ibsen [hidden email] wrote:
> >
> > > Hi
> > > Can you post your yaml configuration of how you try to configure this
> > > kafka value deserializer
> > > On Wed, Dec 5, 2018 at 11:36 AM Yoshimo [hidden email] wrote:
> > >
> > > > Hello Claus,
> > > > thank you for looking into this.
> > > > Camel: 2.23.0
> > > > Kafka: 2.0.0
> > > > SB: 2.1.0.RELEASE
> > > > I am also attaching my pom if you want to have a look.
> > > > Thank you,
> > > > Yiannis
> > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > On Wednesday, 5 December 2018 12:15, Claus Ibsen [hidden email] wrote:
> > > >
> > > > > Hi
> > > > > What version of Camel, Kafka and SB are you using?
> > > > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
> > > > >
> > > > > > Hello Camel users,
> > > > > > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > > > > > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > > > > > and I am trying to set this configuration in my yaml file:
> > > > > > camel.component.kafka.configuration.value-deserializer
> > > > > > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > > > > > Thank you,
> > > > > > Yiannis
> > > > >
> > > > > --
> > > > > Claus Ibsen
> > > > > http://davsclaus.com @davsclaus
> > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
> > > --
> > > Claus Ibsen
> > >
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
>
> --
>
> Claus Ibsen
>
> ------------
>
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Yoshimo
I have created a demo project which demonstrates the issue. The issue is in application.properties file and in TestRoute class.

https://drive.google.com/file/d/1PDZj5tNXqqr0EjB07wluLiwy4ACK1eiP/view?usp=sharing

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, 6 December 2018 10:41, Yoshimo <[hidden email]> wrote:

> I have attached a demo project which demonstrates the issue. The issue is in application.properties file and in TestRoute class.
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, 5 December 2018 14:33, Yoshimo [hidden email] wrote:
>
> > Hey Claus,
> > I think that you misread my previous email. The value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer line is the logging output of the Kafka consumer being created by Camel when I try adding the Spring Boot configuration.
> > What I actually add to my yaml file is the following:
> > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > The above is being ignored and the Kafka consumer that gets created by Camel has the default deserialer.
> > Thank you
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > On Wednesday, 5 December 2018 14:17, Claus Ibsen [hidden email] wrote:
> >
> > > On Wed, Dec 5, 2018 at 12:56 PM Yoshimo [hidden email] wrote:
> > >
> > > > Here is what I add to my yaml file:
> > > > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > and here is my route:
> > > >
> > > >                 from("kafka:prices?brokers={{kafka.servers}}")
> > > >                                 .convertBodyTo(DBModel.class)
> > > >                 ......
> > > >
> > > >
> > > > With this setup when I start the app I can see in the logs the Kafka configuration in the consumer:
> > > > value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
> > >
> > > Try with
> > > value.deserializer = org.apache.kafka.common.serialization.StringDeserializer
> > >
> > > > and I get exceptions while deserializing. However if I remove the config from the yaml file and update my route to be:
> > > > kafka:prices?brokers={{kafka.servers}}&valueDeserializer=com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > then I see the following in the Kafka consumer config:
> > > > value.deserializer = class com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > and the app works as expected. Just for reference the rest of my yaml file is:
> > > > kafka:
> > > > sportsTopic: sports
> > > > pricesTopic: prices
> > > > servers: localhost:25445
> > > > streams:
> > > > "[application.id]": price-publisher
> > > > "[bootstrap.servers]": ${kafka.servers}
> > > > "[default.key.serde]": com.openbet.platform.pricepublisher.serde.ActivityKeySerDe
> > > > "[default.value.serde]": com.openbet.platform.pricepublisher.serde.ActivityValueSerDe
> > > > Thank you,
> > > > Yiannis
> > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > On Wednesday, 5 December 2018 13:30, Claus Ibsen [hidden email] wrote:
> > > >
> > > > > Hi
> > > > > Can you post your yaml configuration of how you try to configure this
> > > > > kafka value deserializer
> > > > > On Wed, Dec 5, 2018 at 11:36 AM Yoshimo [hidden email] wrote:
> > > > >
> > > > > > Hello Claus,
> > > > > > thank you for looking into this.
> > > > > > Camel: 2.23.0
> > > > > > Kafka: 2.0.0
> > > > > > SB: 2.1.0.RELEASE
> > > > > > I am also attaching my pom if you want to have a look.
> > > > > > Thank you,
> > > > > > Yiannis
> > > > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > > > On Wednesday, 5 December 2018 12:15, Claus Ibsen [hidden email] wrote:
> > > > > >
> > > > > > > Hi
> > > > > > > What version of Camel, Kafka and SB are you using?
> > > > > > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
> > > > > > >
> > > > > > > > Hello Camel users,
> > > > > > > > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > > > > > > > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > > > > > > > and I am trying to set this configuration in my yaml file:
> > > > > > > > camel.component.kafka.configuration.value-deserializer
> > > > > > > > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > > > > > > > Thank you,
> > > > > > > > Yiannis
> > > > > > >
> > > > > > > --
> > > > > > > Claus Ibsen
> > > > > > > http://davsclaus.com @davsclaus
> > > > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > >
> > > > > --
> > > > > Claus Ibsen
> > > > > http://davsclaus.com @davsclaus
> > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
> > > --
> > > Claus Ibsen
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2


Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

lburgazzoli
I think you only need to add camel-kafka-starter as a dependency to
make it working.
Every component has a related starter that does the spring-boot magic

---
Luca Burgazzoli
On Thu, Dec 6, 2018 at 9:54 AM Yoshimo <[hidden email]> wrote:

>
> I have created a demo project which demonstrates the issue. The issue is in application.properties file and in TestRoute class.
>
> https://drive.google.com/file/d/1PDZj5tNXqqr0EjB07wluLiwy4ACK1eiP/view?usp=sharing
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Thursday, 6 December 2018 10:41, Yoshimo <[hidden email]> wrote:
>
> > I have attached a demo project which demonstrates the issue. The issue is in application.properties file and in TestRoute class.
> >
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > On Wednesday, 5 December 2018 14:33, Yoshimo [hidden email] wrote:
> >
> > > Hey Claus,
> > > I think that you misread my previous email. The value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer line is the logging output of the Kafka consumer being created by Camel when I try adding the Spring Boot configuration.
> > > What I actually add to my yaml file is the following:
> > > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > The above is being ignored and the Kafka consumer that gets created by Camel has the default deserialer.
> > > Thank you
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > On Wednesday, 5 December 2018 14:17, Claus Ibsen [hidden email] wrote:
> > >
> > > > On Wed, Dec 5, 2018 at 12:56 PM Yoshimo [hidden email] wrote:
> > > >
> > > > > Here is what I add to my yaml file:
> > > > > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > > and here is my route:
> > > > >
> > > > >                 from("kafka:prices?brokers={{kafka.servers}}")
> > > > >                                 .convertBodyTo(DBModel.class)
> > > > >                 ......
> > > > >
> > > > >
> > > > > With this setup when I start the app I can see in the logs the Kafka configuration in the consumer:
> > > > > value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
> > > >
> > > > Try with
> > > > value.deserializer = org.apache.kafka.common.serialization.StringDeserializer
> > > >
> > > > > and I get exceptions while deserializing. However if I remove the config from the yaml file and update my route to be:
> > > > > kafka:prices?brokers={{kafka.servers}}&valueDeserializer=com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > > then I see the following in the Kafka consumer config:
> > > > > value.deserializer = class com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > > and the app works as expected. Just for reference the rest of my yaml file is:
> > > > > kafka:
> > > > > sportsTopic: sports
> > > > > pricesTopic: prices
> > > > > servers: localhost:25445
> > > > > streams:
> > > > > "[application.id]": price-publisher
> > > > > "[bootstrap.servers]": ${kafka.servers}
> > > > > "[default.key.serde]": com.openbet.platform.pricepublisher.serde.ActivityKeySerDe
> > > > > "[default.value.serde]": com.openbet.platform.pricepublisher.serde.ActivityValueSerDe
> > > > > Thank you,
> > > > > Yiannis
> > > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > > On Wednesday, 5 December 2018 13:30, Claus Ibsen [hidden email] wrote:
> > > > >
> > > > > > Hi
> > > > > > Can you post your yaml configuration of how you try to configure this
> > > > > > kafka value deserializer
> > > > > > On Wed, Dec 5, 2018 at 11:36 AM Yoshimo [hidden email] wrote:
> > > > > >
> > > > > > > Hello Claus,
> > > > > > > thank you for looking into this.
> > > > > > > Camel: 2.23.0
> > > > > > > Kafka: 2.0.0
> > > > > > > SB: 2.1.0.RELEASE
> > > > > > > I am also attaching my pom if you want to have a look.
> > > > > > > Thank you,
> > > > > > > Yiannis
> > > > > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > > > > On Wednesday, 5 December 2018 12:15, Claus Ibsen [hidden email] wrote:
> > > > > > >
> > > > > > > > Hi
> > > > > > > > What version of Camel, Kafka and SB are you using?
> > > > > > > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
> > > > > > > >
> > > > > > > > > Hello Camel users,
> > > > > > > > > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > > > > > > > > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > > > > > > > > and I am trying to set this configuration in my yaml file:
> > > > > > > > > camel.component.kafka.configuration.value-deserializer
> > > > > > > > > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > > > > > > > > Thank you,
> > > > > > > > > Yiannis
> > > > > > > >
> > > > > > > > --
> > > > > > > > Claus Ibsen
> > > > > > > > http://davsclaus.com @davsclaus
> > > > > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > > >
> > > > > > --
> > > > > > Claus Ibsen
> > > > > > http://davsclaus.com @davsclaus
> > > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> > > > --
> > > > Claus Ibsen
> > > > http://davsclaus.com @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Kafka component Spring boot auto configuration

Yoshimo
Indeed, I added it and it works! Thank you very much!


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, 6 December 2018 11:03, Luca Burgazzoli <[hidden email]> wrote:

> I think you only need to add camel-kafka-starter as a dependency to
> make it working.
> Every component has a related starter that does the spring-boot magic
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Luca Burgazzoli
> On Thu, Dec 6, 2018 at 9:54 AM Yoshimo [hidden email] wrote:
>
> > I have created a demo project which demonstrates the issue. The issue is in application.properties file and in TestRoute class.
> > https://drive.google.com/file/d/1PDZj5tNXqqr0EjB07wluLiwy4ACK1eiP/view?usp=sharing
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > On Thursday, 6 December 2018 10:41, Yoshimo [hidden email] wrote:
> >
> > > I have attached a demo project which demonstrates the issue. The issue is in application.properties file and in TestRoute class.
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > On Wednesday, 5 December 2018 14:33, Yoshimo [hidden email] wrote:
> > >
> > > > Hey Claus,
> > > > I think that you misread my previous email. The value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer line is the logging output of the Kafka consumer being created by Camel when I try adding the Spring Boot configuration.
> > > > What I actually add to my yaml file is the following:
> > > > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > The above is being ignored and the Kafka consumer that gets created by Camel has the default deserialer.
> > > > Thank you
> > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > On Wednesday, 5 December 2018 14:17, Claus Ibsen [hidden email] wrote:
> > > >
> > > > > On Wed, Dec 5, 2018 at 12:56 PM Yoshimo [hidden email] wrote:
> > > > >
> > > > > > Here is what I add to my yaml file:
> > > > > > camel.component.kafka.configuration.value-deserializer: com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > > > and here is my route:
> > > > > >
> > > > > >                 from("kafka:prices?brokers={{kafka.servers}}")
> > > > > >                                 .convertBodyTo(DBModel.class)
> > > > > >                 ......
> > > > > >
> > > > > >
> > > > > > With this setup when I start the app I can see in the logs the Kafka configuration in the consumer:
> > > > > > value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
> > > > >
> > > > > Try with
> > > > > value.deserializer = org.apache.kafka.common.serialization.StringDeserializer
> > > > >
> > > > > > and I get exceptions while deserializing. However if I remove the config from the yaml file and update my route to be:
> > > > > > kafka:prices?brokers={{kafka.servers}}&valueDeserializer=com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > > > then I see the following in the Kafka consumer config:
> > > > > > value.deserializer = class com.openbet.platform.pricepublisher.serde.SportsEventDeserializer
> > > > > > and the app works as expected. Just for reference the rest of my yaml file is:
> > > > > > kafka:
> > > > > > sportsTopic: sports
> > > > > > pricesTopic: prices
> > > > > > servers: localhost:25445
> > > > > > streams:
> > > > > > "[application.id]": price-publisher
> > > > > > "[bootstrap.servers]": ${kafka.servers}
> > > > > > "[default.key.serde]": com.openbet.platform.pricepublisher.serde.ActivityKeySerDe
> > > > > > "[default.value.serde]": com.openbet.platform.pricepublisher.serde.ActivityValueSerDe
> > > > > > Thank you,
> > > > > > Yiannis
> > > > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > > > On Wednesday, 5 December 2018 13:30, Claus Ibsen [hidden email] wrote:
> > > > > >
> > > > > > > Hi
> > > > > > > Can you post your yaml configuration of how you try to configure this
> > > > > > > kafka value deserializer
> > > > > > > On Wed, Dec 5, 2018 at 11:36 AM Yoshimo [hidden email] wrote:
> > > > > > >
> > > > > > > > Hello Claus,
> > > > > > > > thank you for looking into this.
> > > > > > > > Camel: 2.23.0
> > > > > > > > Kafka: 2.0.0
> > > > > > > > SB: 2.1.0.RELEASE
> > > > > > > > I am also attaching my pom if you want to have a look.
> > > > > > > > Thank you,
> > > > > > > > Yiannis
> > > > > > > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > > > > > > On Wednesday, 5 December 2018 12:15, Claus Ibsen [hidden email] wrote:
> > > > > > > >
> > > > > > > > > Hi
> > > > > > > > > What version of Camel, Kafka and SB are you using?
> > > > > > > > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo [hidden email] wrote:
> > > > > > > > >
> > > > > > > > > > Hello Camel users,
> > > > > > > > > > I am trying to auto configure the Kafka component using spring boot, but the configuration is not working. More specifically I am following this page:
> > > > > > > > > > https://github.com/apache/camel/blob/master/components/camel-kafka/src/main/docs/kafka-component.adoc
> > > > > > > > > > and I am trying to set this configuration in my yaml file:
> > > > > > > > > > camel.component.kafka.configuration.value-deserializer
> > > > > > > > > > However the default deserializer is used when I consume from the Kafka topic. If I specify the deserializer in the Kafka route then it works as expected. Also I have defined the configuration camel.springboot.name in my yaml file and I can see that it is picked up normally. Are there any configurations that enable this functionality and I am missing?
> > > > > > > > > > Thank you,
> > > > > > > > > > Yiannis
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Claus Ibsen
> > > > > > > > > http://davsclaus.com @davsclaus
> > > > > > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > > > >
> > > > > > > --
> > > > > > > Claus Ibsen
> > > > > > > http://davsclaus.com @davsclaus
> > > > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > >
> > > > > --
> > > > > Claus Ibsen
> > > > > http://davsclaus.com @davsclaus
> > > > > Camel in Action 2: https://www.manning.com/ibsen2