1
votes

I am using spring-cloud-stream kafka binder to consume messages from a kafka topic. The source system is sending the json message in ascii. When My consumer listens to the topic it throws

o.s.c.s.b.k.KafkaMessageChannelBinder    : Could not convert message: 7B22736..

Is there any property that I can set in my .yml file to deserialize it? or is there an example that I can look into?

3
@ka2 I saw your comment in link did you ever found the solution for your problem? - sw-enthusiast

3 Answers

0
votes

I am not sure what you mean by json in hexadecimal-binary data if you mean it's ascii data in a byte[], try adding spring.cloud.stream.bindings.input.content-type=text/plain (or application/json).

0
votes

You can look for the configuration property here: http://docs.spring.io/spring-cloud-stream/docs/Brooklyn.SR2/reference/htmlsingle/#_kafka_consumer_properties

In your case, you can set this by doing the following:

spring.cloud.stream.kafka.bindings.<channelName>.consumer.configuration.value.deserializer=<Deserialzier class>

Kafka binder takes all properties from the configuration map. Thus you can use any generic Kafka consumer properties and pass them this way.

0
votes

When I added content-type:plain/text and spring.cloud.stream.bindings.<subscriptionChannel>.consumer.‌​headerMode:raw it worked.

Thank you!