Author |
Message
|
mandy13 |
Posted: Mon Sep 23, 2013 2:59 am Post subject: Fetching Queue Name |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
Hi,
I have a program which reads data from 5 different queues. I have 1 listener which listenes to all the queues for messages.
When I receive a messgage from any 1 of the 5 queues using MQGET, is it possible to know from which queue the message has arrived?
I checked REPLYTOQ field in message descriptor, but it was blank.
Thanks,
Mandar |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Sep 23, 2013 3:04 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
When you issued the MQGET, you used an Object Handle as one of the parameters of the MQGET call.
You got that Object Handle when you did a successful MQOPEN on the queue. When you issued the MQOPEN, you supplied the queue name.
Keep track of which Object Handles go with which Queue Names. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
mandy13 |
Posted: Mon Sep 23, 2013 3:25 am Post subject: |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
"We need to get the queue name from the message" - so is there any way that we can get from the message |
|
Back to top |
|
 |
Vitor |
Posted: Mon Sep 23, 2013 3:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mandy13 wrote: |
"We need to get the queue name from the message" |
Why? What's the requirement?
mandy13 wrote: |
is there any way that we can get from the message |
No.
How would the message know what queue it was in, given the number of queues it can traverse going from one queue manager to another?
Why would IBM build such a feature, given that any application reading a message from a queue must explicitly know which queue it came from to be able to read it? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mandy13 |
Posted: Mon Sep 23, 2013 5:51 am Post subject: |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
Thanks Vitor for your reply
I am reading from several queues using MQCB and depending upon the queue from which the message comes from i need to send it to different applications.
I need the queue name so that i can categorize the message and send it to the appropriate application.
Thanks,
Mandy |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Sep 23, 2013 6:09 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
PaulClarke |
Posted: Mon Sep 23, 2013 6:13 am Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
If you are using MQCB then you should look at the Callback Context structure (MQCBC) to see why you have been called. In that structure is the handle (MQHOBJ) which has been used to retrieve the message. Assuming you have kept a list of the handles that you opened you can easily determine which queue the message was got from.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
wmbwmq |
Posted: Mon Sep 23, 2013 10:05 am Post subject: |
|
|
 Acolyte
Joined: 18 Jul 2011 Posts: 66
|
Quote: |
How would the message know what queue it was in, given the number of queues it can traverse going from one queue manager to another?
|
Why not? if the MQMD can contain replytoQ and replytoQMGR why do you think sourceQueue is something impossible?, well just that IBM didn't include it unfortunately. Btw, Message Broker populates the source queue right into the MQMD header (that is by default).
Quote: |
Why would IBM build such a feature, given that any application reading a message from a queue must explicitly know which queue it came from to be able to read it?
|
I am so sorry but I personally dislike someone commenting on someones's design. We are not in his shoes nor what kind design restrictions they are facing in this global + frequent company takeover/merging kind of scenarios...so... |
|
Back to top |
|
 |
mandy13 |
Posted: Thu Sep 26, 2013 1:46 am Post subject: |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
Thanks Paul and wmbwmq for your suggestions. |
|
Back to top |
|
 |
|