headers lost after message is read from rabbit queue

765 views
Skip to first unread message

Andra Bennett

unread,
Jul 19, 2016, 4:32:56 PM7/19/16
to rabbitmq-users
Hi there!

I've been running into an unexpected scenario when sending and reading messages off the queue. 
I send messages with a fixed set of headers and upon reading the message off the queue I don't see the same headers sent, but instead 'amqp_receivedExchange', 'amqp_redelivered', 'amqp_consumerQueue' etc.
I have verified that headers are there upon send but missing/replaced on read via o.s.integration.handler.LoggingHandler (and debugging...)

What is the contract regarding message headers? Am I correct to expect that message headers remain intact through a rabbitmq send/read? 
I skimmed through some of the documentation on how message headers are used but I couldn't find anything conclusive.

I am using rabbitmq server 3.6.0.
Producer/consumers of rabbitmq messages use spring-integration 4.2.7. 

Is this by any chance a version mismatch issue?

Thank you, 
Andra

Andra Bennett

unread,
Jul 19, 2016, 4:52:13 PM7/19/16
to rabbitmq-users
Seems like this might be a spring configuration issue (see AmqpHeaderMapper in http://docs.spring.io/spring-integration/reference/html/amqp.html)

Michael Klishin

unread,
Jul 19, 2016, 5:02:43 PM7/19/16
to rabbitm...@googlegroups.com
RabbitMQ and in particular plugins could inject headers, or append to header values
that are collections but I cannot think of a case besides [1] when headers are removed.


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Gary Russell

unread,
Jul 20, 2016, 8:35:57 AM7/20/16
to rabbitm...@googlegroups.com
> I don't see the same headers sent, but instead 'amqp_receivedExchange', 'amqp_redelivered', 'amqp_consumerQueue' etc.


Spring Integration is designed to interact with many different protocols, RabbitMQ, JMS, HTTP, etc. The canonical message is a spring-messaging Message<?>.

In order to avoid conflicts with header names, by convention, it maps standard properties to/from Spring Messaging headers by prefixing the header name with something that represents the source/target protocol (in this case _amqp). 

Since the same mapping is applied on outbound, this is transparent.

With versions prior to 4.3, custom headers were not mapped by default, but you can configure Spring Integration to do so. See the documentation about header mapping [1]. 4.3 now maps all headers by default.

You can also provide your own header mapper if you don't like the default behavior.

Can you describe exactly what issue this is causing for you?

Since this is really a Spring Integration question, not a rabbitmq question, the correct place for such questions is Stack Overflow with the spring-integration tag.


Reply all
Reply to author
Forward
0 new messages