Author |
Message
|
okuye |
Posted: Wed Jul 31, 2002 5:28 am Post subject: Multiple Instances of MQ Client App. on one workstation |
|
|
Newbie
Joined: 31 Jul 2002 Posts: 5 Location: Markham, ON, Canada
|
I have a fairly powerful machine and wondering if I can run multiple instances of my MQ Client app. pointing to the same Queue Manager on the MQ Server. The aim is to empty items in a queue quickly without using a second or third machine. Found out that the connection handles from each app instance are the same. Am I doing something wrong? and what are the pros/cons of doing this? |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jul 31, 2002 8:46 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
If I understand what you are saying, the answer is yes. I frequently will bring up multiple versions of either amqsputc or amqsgetc in different command windows and run them against the same queue manager. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Jul 31, 2002 11:51 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
I don't understand how the connection handles can be the same between instances. Don't they each do their own MQCONN and MQOPEN? If so, they should each have their own handles.
IF somehow they are the same, be aware that commits happen at the Queue Manager Handle level. So if you have 20 queue actions done with one QM handle, and somehow 3 diff instances shared that handle, if one of them commits (or backs out), ALL the work is undone or commited for all 3 instances.
But again, I don't see how they could have the same handles. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
okuye |
Posted: Thu Aug 01, 2002 4:04 am Post subject: |
|
|
Newbie
Joined: 31 Jul 2002 Posts: 5 Location: Markham, ON, Canada
|
Let me clarify the "Connection handles being the same", when I called MQCONN (connecting to the default Queue Manager) on each instance of the MQClient, the handle returned is always "5". Shouldn't this value be different for each instance?
As mentioned, if I Commit or Backout a transaction in one instance will this affect another instance? I hope not!
Thanks in advance for your assistance |
|
Back to top |
|
 |
mrlinux |
Posted: Thu Aug 01, 2002 4:23 am Post subject: |
|
|
 Grand Master
Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA
|
I would look at your application, I have not seen a connection handle with that low of value, I suspect you are not printing out the actual connection handle. _________________ Jeff
IBM Certified Developer MQSeries
IBM Certified Specialist MQSeries
IBM Certified Solutions Expert MQSeries |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Aug 01, 2002 6:00 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I just gave this a try on my box. My client application is amqsput0 linked with mqic32.lib. When I run it in two different windows, they both give me a connection handle of 5. When I link with mqm.lib and run, I get two different connection handles in the 4109xxx range. However, I'm still not sure that I would be concerned. The actual qmgr connection is being done on the qmgr in the listener process. I would guess that there is some kind of table that is being kept to keep the connections separate and the 5 just represents something local to the client? |
|
Back to top |
|
 |
okuye |
Posted: Thu Aug 01, 2002 8:42 am Post subject: |
|
|
Newbie
Joined: 31 Jul 2002 Posts: 5 Location: Markham, ON, Canada
|
Another twist to this saga.
I pointed my MQ Client (in VB on NT4) to a queue manager on a Unix Sun Box located miles away from me. I explicitly specified the default queue manager name to be sure it's not using the queue manager on my local machine. (Happy bower5932 has duplicated the "5" connection handle on a single workstation!).
Ran multiple instances of the client, still got a connection handle of "5" in each instance and more THE QUEUE I OPENED ALL HAVE THE SAME HANDLE "269984" in each instance.
Closed queue and opened several times within a connection, new queue handles were issued but they are SAME IN EACH INSTANCE. Any time the queue handle changes in one instance, values in the other instances all change to the new value the next time they get a queue handle! For example, when the first instance gets "269972", the next instance also gets "269972" when I get a queue handle. (They are opening the same queue)
I am just afraid I may get weird behavior if I allow multiple instances of the MQ Client app, especially when one instance commits or backouts. Is there a setting or table that is being used?
Thanks again |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Aug 01, 2002 9:06 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
If the first instance connects succesfully, and then the second one connects, giving you apparently the same handle, what is the reason code for this second instance's MQCONN? Is it 0000, or MQRC_ALREADY_CONNECTED?
Also, are you using the MQCONN call or the MQCONNX call? The MQCONNX allows you to share handles between threads. See Chapter 7 in the App programming guide. Is this maybe what you are doing? If so, read all the details there, but this point jumped out at me:
Any thread can call MQDISC to disconnect a shared Hconn, not just the thread that called the corresponding MQCONNX. The MQDISC will terminate the Hconn making it unavailable to all threads. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
okuye |
Posted: Thu Aug 01, 2002 12:34 pm Post subject: |
|
|
Newbie
Joined: 31 Jul 2002 Posts: 5 Location: Markham, ON, Canada
|
More observations...
The behavior described above in earlier postings is experienced when I use a conditional compilation "MqType=2" for the multiple instances. However, when I use "MqType=1" the connection handle is no longer "5" but a large number. The Connection handle is still the same in all instances but the Queue handle is now unique in each instance.
I am using the MQCONN for connection (also tried MQCONNX-same behavior). Each instance connects successfully and returns 0 for Completion and Reason codes not MQRC_ALREADY_CONNECTED. According to Chap7 in the App Guide, "the scope of an MQCONN call is the application process" but I am feeling a little uneasy about running multiple instances on a workstation.
QUESTION TO EXPERTS: Do you generally recommend MQClients on several workstations when you need to process queues quicker? |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Aug 01, 2002 8:13 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
mqtype=1 means link for server connection (mqm.dll) and
mqtype=2 means link for client connection (mqic32.dll)
I have used multiple clients to do parallel processing (from the same queue) and never had a problem.
later
Roger... |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Aug 02, 2002 10:38 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
|
Back to top |
|
 |
okuye |
Posted: Fri Aug 02, 2002 12:30 pm Post subject: |
|
|
Newbie
Joined: 31 Jul 2002 Posts: 5 Location: Markham, ON, Canada
|
Thank you for all the helpful comments... |
|
Back to top |
|
 |
|