Reputation: 41
I am using Apache Camel and IBM MQ to send messages. I need to receive COA when a message gets delivered to a remote queue. The general picture looks like this:
When the message reaches msg_q2 queue, I should receive the COA back. So, the problem is that I am not able to set the QMGR_REM as reply-to queue manager, which is supposed to produce COA.
https://www.ibm.com/docs/en/ibm-mq/8.0?topic=messages-reply-queue-queue-manager
I tried setting JMS_IBM_MQMD_xxx headers, but for some reason those headers either get omitted or ignored (by Camel?), and the message fails to be put on the queue with the reason that the reply-to queue is not specified. Also, I tried setting JMSReplyTo header as queue://reply-to-qmgr/reply-to-q
. In this case the queue://
part gets removed, and the rest is simply set as a reply-to queue name.
I am relatively new to Apache Camel, and IBM MQ, so any input would be very appreciated. Thank you in advance!
Upvotes: 1
Views: 1290
Reputation: 41
So, basically by trial and error I figured out that adding mdWriteEnabled=true
property onCamelJmsDestinationName
Camel header made it working as I need.
The code is something like this:
route.setHeader("CamelJmsDestinationName", "queue:///msg_q1?targetClient=1&mdWriteEnabled=true")
Then I set reply-to queue manager via MQMD property
route.setHeader("JMS_IBM_MQMD_ReplyToQMgr", "QMGR_REM")
and reply-to queue
route.setHeader("JMSReplyTo", "replyToQ2")
Upvotes: 1
Reputation: 7525
In your application, just provide the name of your ReplyToQ as replyToQ1
and leave the ReplyToQMgr field blank. The queue manager will fill it in with the local queue manager name QMGR_LOC
for you.
And on QMGR_REC
do one of the following:-
If your transmission queue for the channel from QMGR_REM
to QMGR_LOC
is named exactly QMGR_LOC
, you have nothing further to do. When QMGR_REM
comes to put the COA onto queue replyToQ1
on queue manager QMGR_LOC
, it will resolve it to the transmission queue that has the name QMGR_LOC
and the channel will deliver it.
If your transmission queue for the channel from QMGR_REM
to QMGR_LOC
is not named exactly QMGR_LOC
, then make the following definition on QMGR_REM
:
DEFINE QREMOTE(QMGR_LOC) RNAME(' ') RQMNAME(QMGR_LOC) +
XMITQ(your-transmission-queue-going-to-QMGR_LOC)
Upvotes: 2