
Originally Posted by
Gary Russell
There is no override effect - the standard amqp headers are copied plus your specified headers.
You cannot propagate the replyChannel over AMQP - it is a live java object where some thread is waiting in receive() to receive a reply.
What do you want to do with the replyChannel on the other system?
I don't want to do anything with the replyChannel per say. I was debugging, trying to figure out why I wasn't getting a response for the message I sent. I configured a gateway and an amqb outbound channel adapter on one end and I was expecting to receive a response generated by the other end. What I was seeing was no response and the message was still in the queue. So I started debugging and found out there was some swallowed exception "The replyTo header must not be null on a request Message being handled by the AMQP inbound gateway." I looked at the message headers and I noticed that header wasn't there. I removed the mapped-request-headers="requestType" attribute and the exception stopped happening. I noticed that the message now had a few headers that I wasn't seeing before.
The message header without mapped-request-header:
Code:
[Headers={timestamp=1335294252037,
id=7748e09a-fea6-41a2-acc3-57524edb8e28,
errorChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@6184d88,
amqp_receivedRoutingKey=si.test.queue,
amqp_deliveryMode=PERSISTENT,
replyChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@6184d88,
amqp_contentType=text/plain, amqp_contentEncoding=UTF-8, amqp_deliveryTag=1, amqp_redelivered=false}]
with the mapped-request-headers I was only seeing:
Code:
[Headers={requestType=hello}
This is what brought me to the conclusion that the default headers were somehow being replaced. If that's not the case, please tell me what I'm doing wrong.
Just for reference, the other side looks like this (omitting the channel defs):
Code:
<int-amqp:inbound-gateway id="inboundGateway"
request-channel="requestChannel" connection-factory="connectionFactory"
queue-names="si.test.queue" reply-channel="replayChannel"
error-channel="errorChannel" mapped-request-headers="requestType" />
<int:header-value-router id="headerRouter"
header-name="requestType" input-channel="requestChannel">
<int:mapping value="hello" channel="helloServiceChannel" />
<int:mapping value="goodbye" channel="goodbyeServiceChannel" />
</int:header-value-router>
<int:service-activator input-channel="helloServiceChannel"
ref="helloService" method="hello" />
<int:service-activator input-channel="goodbyeServiceChannel"
ref="goodbyeService" method="goodbye" />
Thanks again.