git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Kafka component Spring boot auto configuration


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 <claus.ibsen@xxxxxxxxx> 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 yoshimo@xxxxxxxxxxxxxx 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 claus.ibsen@xxxxxxxxx wrote:
> >
> > > Hi
> > > What version of Camel, Kafka and SB are you using?
> > > On Tue, Dec 4, 2018 at 8:59 AM Yoshimo yoshimo@xxxxxxxxxxxxxx.invalid 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