SRaj
SRaj

Reputation: 1328

Custom Headers are lost in Camel while sending message to Kafka

I have the following route. It is strange that the custom header value "myHeader" is lost at the consumer side of Kafka.

Can you please let me know what is the reason for this and how I can solve this issue.

from("file://inputFolder?delay=2s&noop=true")
.convertBodyTo(String.class)
.setHeader("myHeader", constant("MY_HEADER_VALUE"))
.to("kafka:test-topic?brokers=localhost:9092");

from("kafka:test-topic?brokers=localhost:9092")
.log("${body}")
.log("***** myHeader: ${header.myHeader}")

The value of myHeader is an empty string though I set it as ""MY_HEADER_VALUE".

We use Apache Camel 2.20.2 and Spring Boot version 1.5.10.RELEASE.

Upvotes: 1

Views: 2748

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55750

Okay so this is not supported in this older Camel version you use. Its supported from Camel 2.22 onwards, see ticket: https://issues.apache.org/jira/browse/CAMEL-12503

Upvotes: 5

Related Questions