Reputation: 426
I have a Camel client using the JMS Component to connect with IBMMQ.
I need to
My configuration is:
.setHeader("CamelJmsDestinationName", "queue:///requestQueue.AQ?targetClient=1")
.setHeader("JMSCorrelationID", "SomeValue")
.to("jms:queue:requestQueue.AQ?useMessageIDAsCorrelationID=true&replyTo=ResponseQueue")
The issue is that JMSCorrelationID is null when useMessageIDAsCorrelationID=true
JMSMessageID: ID:c3e2d840d8d4e3f14040404040404040d95c7873193bef06
JMSTimestamp: 1614870096440
JMSCorrelationID: null
When useMessageIDAsCorrelationID=false the JMSCorrelationID is set as intended, but I get a timeout on correlation. How to use both?
Upvotes: 0
Views: 1648
Reputation: 426
As a way around the issue I made the following changes to the .to() endpoint options:
Then the message is sent with a JMSCorrelationID, but without waiting on the reply. Thereafter I set a pollEnrich() dynamically with a simple expression using the JMSMessageID created by the broker which is filtered by a JMS Selector:
The Camel route:
.setHeader("CamelJmsDestinationName", "queue:///requestQueue.AQ?targetClient=1")
.setHeader("JMSCorrelationID", "SomeValue")
.to("jms://RequestQueue?useMessageIDAsCorrelationID=false&exchangePattern=InOnly&replyTo=ReplyQueue&includeSentJMSMessageID=true")
.pollEnrich().simple("jms://ReplyQueue?selector=JMSMessageID='${header.JMSMessageID}').timeout(20000)
.log("${body}")
Upvotes: 1