Main question: While everything works on my setup, I mean producing and consuming messages work with messages and keys, but message headers
are not received on the consumer side, is there any specific configuration for allowing message headers on a Kafka cluster?
I'm using a laravel kafka package, everything is working just fine, I have a producer and a consumer both with Laravel and the mentioned package, and for the Kafka I'm using bitnami/kafka docker image. and everything works just fine. I can produce messages on a topic and successfully receive them on the consumer side.
Yet, the weird thing is that on the consumer side the headers are not available. it's lost somehow but I can get the message itself and the key and everything else.
$message = new Message(
body: [
'name' => 'test',
],
headers: [
'anotherName' => 'test',
],
key: '1'
);
Kafka::publishOn($topic)->withMessage($message)
I have also tested other methods mentioned in the docs, such as withHeaders()
, still not working.
I'm suspicious that there is something wrong with my Kafka setup, is there any specific change needed to be applied on Kafka for having headers on the messages?