sroze / messenger-enqueue-transport

Uses Enqueue with Symfony's Messenger component.
MIT License
191 stars 55 forks source link

How to access the Kafka "key" property when consuming? Or any other Kafka specific metadata? #124

Open cousinjoe opened 1 year ago

cousinjoe commented 1 year ago

Following the README directions it's easy enough to set the topic and key value for a Kafka message using the TransportConfiguration stamp (header). However, I am not sure how to access that property when consuming the message back into the Symfony app either through the message handler class or through a custom serializer "decode()" method. Any feedback or help would be greatly appreciated. Perhaps an addition to the README docs showing a use case for consuming a Kafka message that utilized the TransportConfiguration stamp when being produced would be helpful. Thanks!

cluster28 commented 1 year ago

Hi @cousinjoe in messenger envelope there is an InteropMessageStamp (injected by QueueInteropTransport) with a RdKafkaMessage inside where you can find some metada.