I have saved topic in header and try to access it in the Kafka URL as below:
from(...)
.process(...)
.to("kafka:${header.topic}?brokers=localhost:9092")
Unfortunately it says the Kafka URL is invalid:
org.apache.kafka.common.errors.InvalidTopicException: Invalid topics: [${header.topic}]
I have tried replace the to(...)
with .log("${header.topic}")
and the expected value can be printed in the logline.
Does anyone know what causes the issue, am I supposed to escape the dollar sign or the curly braces?
you need to use send dynamic so replace to with toD