Author |
Message
|
seenutheleo |
Posted: Mon Jun 18, 2012 3:32 am Post subject: MQ Multi threaded C++ Application |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
Hi,
I developed one event monitoring c++ application which listens on 3 event queues and try to get messages using MQGET. But most of the times MQGET fails with MQRC_CALL_IN_PROGRESS(2219) error. I am spawning three threads and in each thread i call MQCONNX, MQOPEN, MQGET calls. I get new handler for each MQCONNX in each thread, but MQOPEN handler returned is the same in all the threads( in my case its always 101) even though i am opening 3 different queues in different threads... Struggling with this from past 1 week. Please help me if any one knows whats the issue. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 18, 2012 3:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
bindings connections? or client connections?
what's the mqrc from the mqopen? Is there any thing in the mq logs when the 2219 occurs? |
|
Back to top |
|
 |
seenutheleo |
Posted: Mon Jun 18, 2012 4:22 am Post subject: mqrc for mqopen is 0 |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
mqjeff wrote: |
bindings connections? or client connections?
what's the mqrc from the mqopen? Is there any thing in the mq logs when the 2219 occurs? |
mqrc for mqopen is 0. This is a client multi threaded connection. How to check MQ logs, do i need to login to the server and check them? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 18, 2012 6:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Are you using the threadsafe libraries for your compiles?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
seenutheleo |
Posted: Mon Jun 18, 2012 8:29 am Post subject: thread safe libraries... |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
fjb_saper wrote: |
Are you using the threadsafe libraries for your compiles?  |
No, i dont know.. Are there any thread safe libraries for MQ? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 18, 2012 8:58 am Post subject: Re: thread safe libraries... |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
seenutheleo wrote: |
fjb_saper wrote: |
Are you using the threadsafe libraries for your compiles?  |
No, i dont know.. Are there any thread safe libraries for MQ? |
You may notice that there are a few libraries that appear twice:
name and name_r. If you need a threadsafe behavior be sure to use the ones ending in _r  _________________ MQ & Broker admin |
|
Back to top |
|
 |
seenutheleo |
Posted: Mon Jun 18, 2012 9:04 am Post subject: Re: thread safe libraries... |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
fjb_saper wrote: |
seenutheleo wrote: |
fjb_saper wrote: |
Are you using the threadsafe libraries for your compiles?  |
No, i dont know.. Are there any thread safe libraries for MQ? |
You may notice that there are a few libraries that appear twice:
name and name_r. If you need a threadsafe behavior be sure to use the ones ending in _r  |
Now i am using thread safe libraries.. Still MQGET fails with 2219..
My application
thread 1
MQCONNX
MQOPEN to queue(SYSTEM.ADMIN.QMGR.EVENT)
MEGET(waiting here on time out of 10 sec and again calling MQGET)
Here on time out when i call MQGET it always returns with 2219. Even if i retry the MQGET same result.
thread 2
MQCONNX
MQOPEN(SYSTEM.ADMIN.PERF.EVENT)
MQGET(Waiting here on timeout of 10 sec and again calling MQGET)
Here its fine |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 18, 2012 9:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
To exclude the more obvious...
Check the channel and set the sharecnv (share conversation) parameter to 1.
Also can you specify the exact version (including fix pack if any) of MQ you are using?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
seenutheleo |
Posted: Mon Jun 18, 2012 9:19 am Post subject: |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
fjb_saper wrote: |
To exclude the more obvious...
Check the channel and set the sharecnv (share conversation) parameter to 1.
Also can you specify the exact version (including fix pack if any) of MQ you are using?  |
Share Conversations was 10, i set it to 1.. still no use...Do i need to restart something after settign this?
My MQ Client Version
bash-3.2$ dspmqver
Name: WebSphere MQ
Version: 7.0.1.3
CMVC level: p701-103-100813
BuildType: IKAP - (Production)
MQ Server Version:
7.0.1.3 |
|
Back to top |
|
 |
bob_buxton |
Posted: Mon Jun 18, 2012 9:20 am Post subject: |
|
|
 Master
Joined: 23 Aug 2001 Posts: 266 Location: England
|
wrong thread _________________ Bob Buxton
Ex-Websphere MQ Development |
|
Back to top |
|
 |
seenutheleo |
Posted: Mon Jun 18, 2012 9:25 am Post subject: |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
bob_buxton wrote: |
wrong thread |
What do you mean by wrong thread? |
|
Back to top |
|
 |
bob_buxton |
Posted: Mon Jun 18, 2012 9:39 am Post subject: |
|
|
 Master
Joined: 23 Aug 2001 Posts: 266 Location: England
|
I removed my own post because I thought I had posted to wrong thread _________________ Bob Buxton
Ex-Websphere MQ Development |
|
Back to top |
|
 |
bob_buxton |
Posted: Mon Jun 18, 2012 9:47 am Post subject: |
|
|
 Master
Joined: 23 Aug 2001 Posts: 266 Location: England
|
You could consider using the MQCTL/MQCB interface to monitor multiple queues as an alternative to having a multi-threaded application design. _________________ Bob Buxton
Ex-Websphere MQ Development |
|
Back to top |
|
 |
seenutheleo |
Posted: Thu Jun 21, 2012 12:39 am Post subject: MQCB 2012 error |
|
|
Newbie
Joined: 18 Jun 2012 Posts: 7
|
bob_buxton wrote: |
You could consider using the MQCTL/MQCB interface to monitor multiple queues as an alternative to having a multi-threaded application design. |
Hi Bob,
I changed my c++ application to use MQCTL/MQCB... But my MQCB returns with 2012. MQRC_ENVIRONMENT_ERROR. From documentation i understood that its related to not being able to create posix threads from my application. Is there anything i need to do on linux to allow posix threads for c++ applications? |
|
Back to top |
|
 |
bob_buxton |
Posted: Thu Jun 21, 2012 3:15 am Post subject: |
|
|
 Master
Joined: 23 Aug 2001 Posts: 266 Location: England
|
As an ex-Zos developer I am afraid that I am not very familiar with the Linux environment.
If you are using the client libraries that support multi threading I think that it should work. _________________ Bob Buxton
Ex-Websphere MQ Development |
|
Back to top |
|
 |
|