I am consuming messages from IBM Mq using message driven channel adapter (Spring Integration) . JMS Destination property in the message is coming as null. Could someone tell me how to get queue name in header for messages consumed using wmq.
JMS Destination property is coming for messages consumed from apache Active mq but not for IBM MQ.
Asked
Active
Viewed 479 times
1

user6543599
- 541
- 2
- 8
- 18
-
@JoshMc solution isnt available over there too. – user6543599 May 18 '18 at 16:57
-
The fact that you didn't get a answer you like to the first question does not mean you should ask the same duplicate question. You should edit your prior question if you think it is unclear. – JoshMc May 18 '18 at 17:08
-
Yeah. Agreed...!! – user6543599 May 18 '18 at 17:09
1 Answers
0
The DefaultJmsHeaderMapper
has the code like this:
try {
Destination destination = jmsMessage.getJMSDestination();
if (destination != null) {
headers.put(JmsHeaders.DESTINATION, destination);
}
}
catch (Exception ex) {
this.logger.info("failed to read JMSDestination property, skipping", ex);
}
So, if IBM Mq doesn't provide that property value, we really won't have a JmsHeaders.DESTINATION
header on the matter.
I suggest you to investigate all the headers you get after consuming and see what one may have a required destination for you.
Otherwise you always can extend DefaultJmsHeaderMapper
and implement your own logic in the overridden toHeaders()
method.

Artem Bilan
- 113,505
- 11
- 91
- 118
-
I have tried jmsMessage.getJMSDestination() which is returning null as well. I have inspected all the headers which doesn't have queue information. – user6543599 May 18 '18 at 16:39
-
Right. That's what I'm explaining why you don't get the value in the `JmsHeaders.DESTINATION` and I suggest you the way to go. What am I missing, please? – Artem Bilan May 18 '18 at 16:40
-
Thanks for you reply. Does extending DefaultJmsHeaderMapper can solve my issue? Can i get my queue name in the overridden toHeaders() method? – user6543599 May 18 '18 at 16:46
-
Do you not know by context what queue you are reading from? You had to specify the queue name to open it and read messages. – JoshMc May 18 '18 at 16:51
-
I would be consuming a lot queues and passing to a common channel. I would not be knowing the queue name in my channel. – user6543599 May 18 '18 at 16:54
-
You need to consult with IBM to determine in what `JmsMessage` property they populate a `Destination`. And then use that property in the `DefaultJmsHeaderMapper` extension, e.g. call `super.toHeaders()`, check if `JmsHeaders.DESTINATION` header is null and populate a destination from that IBM property. Does it make sense to you? – Artem Bilan May 18 '18 at 16:57