|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MDB getJMSDestination() NULL when source is MQ |
« View previous topic :: View next topic » |
Author |
Message
|
jdwelsh |
Posted: Tue Aug 22, 2006 7:03 am Post subject: MDB getJMSDestination() NULL when source is MQ |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 2
|
I have a message-driven bean that is configured to receive messages on many different queues. Within the MDB, I determine the Queue on which the message was delivered, and use the name of the queue to identify the source of the message and process it properly. The assumption is that the name of the Queue uniquely identifies the source application. The following is a a simple code sample:
public void onMessage(Message msg) {
...
Queue queue = (Queue) msg.getJMSDestination();
...
}
When I test this out by putting the message on the Queue via JMS, this works properly. However, when the message is put in the Queue via MQ, getJMSDestination() returns NULL.
As I did some research, I found that there is a MQRFH2 field "jms.Dst" that seems to correspond to JMSDestination. The MQ experts I've talked with tell me that the generated message does not necessarily have MQRFH2 so using this is not a possibility.
So, my question is this - is there any standard for providing the name of the Queue to a target system? Someone suggested to use MQMD field ReplyToQ, but a colleague told me this is not a standard approach and may face some opposition from MQ guys. I'd prefer not to embed the name of the queue in the message itself, but that is my last resort option.
I'm trying to design an open interface that will be accessible to many clients, and I certainly don't want to add requirements that may face opposition. At the same time, I don't want to client to have to identify themselves other than by putting the message on the correct queue.
Thanks in advance |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Aug 22, 2006 1:19 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jdwelsh wrote: |
So, my question is this - is there any standard for providing the name of the Queue to a target system? Someone suggested to use MQMD field ReplyToQ, but a colleague told me this is not a standard approach and may face some opposition from MQ guys. I'd prefer not to embed the name of the queue in the message itself, but that is my last resort option. |
Don't know where you are getting your advice from... Anyway in JMS we are not talking about queues but Destinations.
In a request reply model the non JMS application sets the replytoQmgr and replytoQueue fields on the message descriptor (MQMD). It also sets the message type to a request message type.
The JMS app reads the JMSReplyto Destination on the message and sends the response to it.
If you are dealing with MQ V6.0 there is a parameter on the MQQueueConnectionFactory (it is set by default) for targetClientMatching. So if your app is non JMS it would get a non JMS reply.
If you are talking about using parameters to set up queue names ... use JNDI or if you must a uri form like:
"queue://qmgr/queue?attr1=val1&attrn=valn"
And read the documentation in the using Java manual....
[edit]
On non MQ messages the origin queue is not accessible in JMS but you can read JMSXAppID which should in this case contain something of interest as the sender can set it.[/edit]
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jdwelsh |
Posted: Wed Aug 23, 2006 5:12 am Post subject: |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 2
|
Quote: |
Don't know where you are getting your advice from... Anyway in JMS we are not talking about queues but Destinations.
In a request reply model the non JMS application sets the replytoQmgr and replytoQueue fields on the message descriptor (MQMD). It also sets the message type to a request message type. |
Yes, I understand this. Just to be be clear about what we're doing ... An external app sends a requst via MQ to our app which receives it using JMS. Our app does not send a response via JMS, instead it broadcasts the contents of the request via e-mail. So, there is no actual need for a JMSReplyTo Destination other than to get the name of the queue.
Thanks for the information. I'll look into using JMSXAppID instead. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 23, 2006 5:16 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Have the sending applications set a JMS Property on the message that indicates the source.
Don't use JMSAppID or any other predefined property for custom business data, please.
If the sending application is NOT a JMS application, then either you can request that the sending application build an MQRFH2 header and put the data into the JMS property that way...
Or you can make sure that the business payload (the message data) contains all of the business data that's needed, including a source identifier. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|