Author |
Message
|
nik_iway |
Posted: Tue Jul 18, 2006 8:49 pm Post subject: MQOPEN() simultaneously for 2 Queues |
|
|
Centurion
Joined: 21 Jul 2005 Posts: 115
|
Hi Everybody,
I am connection to Queue Manager and getting the Queuemanager Connection handle for Connecting to the Queue. I have 2 local Queues. Can it be possible to open the 2 local queues at the same time.
In the Present application i have 2 queues QUEUEA and QUEUEB, i declared them in the array .
While(true)
{
for (int i = o; i < Queueno.length; i++)
in the MQOPEN i am Passing the Queuearray[i]
Wait Unlimited Option Specified in get Message Options
MQGET
}
First its going and picking the message from QUEUEA and then QUEUEB and Again back to QUEUEA then QUEUEB.
I want to simultaneously get the messages from the QUEUEA and QUEUEB using the same QueueManager Connection Handle.....
Wat could be the best possible option....
Thanking you and Regards
Nik |
|
Back to top |
|
 |
mvic |
Posted: Wed Jul 19, 2006 2:03 am Post subject: Re: MQOPEN() simultaneously for 2 Queues |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
nik_iway wrote: |
I want to simultaneously get the messages from the QUEUEA and QUEUEB using the same QueueManager Connection Handle |
It's a restriction in MQ (a reasonable restriction, I think) that you can only do one thing at a time on one hConn.
If you want independent simultaneous MQ activity, you need 2 hConns and 2 threads.
It may help us to comment more helpfully if you would explain why you wish to get messages "simultaneously". |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 19, 2006 3:20 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Don't do this
Quote: |
for (int i = o; i < Queueno.length; i++)
in the MQOPEN i am Passing the Queuearray[i]
Wait Unlimited Option Specified in get Message Options
MQGET
} |
but get the messages on the queue until receiving RC 2033 queue empty.
Search the forum to know why.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
nik_iway |
Posted: Wed Jul 19, 2006 8:34 pm Post subject: |
|
|
Centurion
Joined: 21 Jul 2005 Posts: 115
|
Hi,
I Have a Queuemanager on windows with two queues named QUEUEA and QUEUEB receiving same information but each Queue receiving information from different location say QUEUEA receiving information from LONDON and QUEUEB from NEWYORK. I want to get message from both Queues and write it to a directory. The Present logic that i had written
While(true)
{
for (int i = o; i < Queueno.length; i++)
in the MQOPEN i am Passing the Queuearray[i]
Wait Unlimited Option Specified in get Message Options
MQGET
}
First its going and picking the message from QUEUEA and then QUEUEB and Again back to QUEUEA then QUEUEB and so on...........so if there is no messages in QUEUEA its getting locked... In the Mean time QUEUEB will be filled with Messages from diifferent location.. I just want to by pass the locked state in QUEUEA and go to QUEUEB to pick up the Messages.
I used int depth = Queue.currentdepth()
if (depth == 0)
{
increment the QueueArray
}
else
{
MQOPEN i am Passing the Queuearray[i]
Wait Unlimited Option Specified in get Message Options
MQGET
}
QUEUEA has no messages and QUEUEB has one Messages . the progam is going and picking up in the QUEUEB but its also getting locked in the QUEUEB.....
Is there any alternative way to reach my goal.....
Regards
Nik |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 19, 2006 11:33 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
First - why have you ignored the comment of fjb_saper and are still not looping until 2033? Your method is really not a good one & I'm wondering why you have persisted with it - what's the design logic here?
Second - Is it always the case that QUEUEA and QUEUEB have matching records? How are they matched one to the other? What is the requirement when one side is delayed (e.g. network problems) or indeed not sent at all due to logic error / hardware failure?
A few more details please to assist with a proposed solution.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|