26.7.2. 向 Kafka 生成信息
以下是将消息写入 Kafka 所需的最小路由。
from("direct:start")
.setBody(constant("Message from Camel")) // Message to send
.setHeader(KafkaConstants.KEY, constant("Camel")) // Key of the message
.to("kafka:test?brokers=localhost:9092");
from("direct:start")
.setBody(constant("Message from Camel")) // Message to send
.setHeader(KafkaConstants.KEY, constant("Camel")) // Key of the message
.to("kafka:test?brokers=localhost:9092");