Reputation: 1694
For twitter source it is creating a 30 bit header for each kafka messages if we use custom kafka consumer other than @StreamListener
(Sink).
@StreamListener
sends the messages correctly to the annotated method (no header). The problem is for each source the header size varies.
So how can I dynamically understand the header size of the messages since I'm using custom kafka consumer.?
Or How can I remove the header for each message.?
UPDATE:-
Please find below the message received in kafka-console-consumer
while using a TCP Source.
�
contentType"application/octet-stream"hello world
I just need to get the message only. In this case, hello world
Upvotes: 4
Views: 5578
Reputation: 1017
Could also change this setting to remove the annoying header
spring.cloud.stream.default.producer.useNativeEncoding=true
Upvotes: 0
Reputation: 1694
Setting spring.cloud.stream.default.producer.headerMode=raw
in source will remove the header while reading the message in consumer.
Upvotes: 1
Reputation: 6126
What version of Kafka you are using? The reason why I am asking is that starting 0.11 Kafka supports native headers and you would not have this problem anymore.
Upvotes: 2