Author |
Message
|
mandy13 |
Posted: Mon Apr 22, 2013 11:17 pm Post subject: MQPUT while using MQCB : MQRC_HCONN_ASYNC_ACTIVE |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
Hi,
Our process needs to read messages from a topic on the local Q manager and also write to a different topic on the same local Q manager.
To read messages we have used MQCB. The messages reach the callback function of the process. However, while the callback remains registered, we are not able to MQPUT messages to a different topic.
We get an error that says:
2500 : MQRC_HCONN_ASYNC_ACTIVE
An attempt to issue an MQI call has been made while the connection is started
Apparently, a single connection handle cannot be used to both read and write. We have to Suspend the MQCB, MPUT the message and Resume the MQCB to get it to work.
Is there a way to avoid having to suspend and resume?
Thanks,
Mandy |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 23, 2013 3:14 am Post subject: Re: MQPUT while using MQCB : MQRC_HCONN_ASYNC_ACTIVE |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mandy13 wrote: |
Apparently, a single connection handle cannot be used to both read and write. We have to Suspend the MQCB, MPUT the message and Resume the MQCB to get it to work. |
If the connection is being used asynchronously for a callback I understand that to be true.
mandy13 wrote: |
Is there a way to avoid having to suspend and resume? |
You could use a second connection to put the message. Or use a single connection with a long period MQGet with wait rather than a callback.
Other solutions are undoubtedly possible and may be better. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mandy13 |
Posted: Tue Apr 23, 2013 5:53 am Post subject: |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
Having two connection handles would be ideal. But i guess we can have only 1 connection per queue manager per process.
If we try to create another connection handle it gives a warning that the connection to queue manager already exists and returns the same conneciton handle. |
|
Back to top |
|
 |
mvic |
Posted: Tue Apr 23, 2013 7:10 am Post subject: Re: MQPUT while using MQCB : MQRC_HCONN_ASYNC_ACTIVE |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
mandy13 wrote: |
Apparently, a single connection handle cannot be used to both read and write. We have to Suspend the MQCB, MPUT the message and Resume the MQCB to get it to work. |
Where is your MQPUT being called? From inside the callback function, or on another thread in some other code? If the latter, how is your callback function communicating with the thread that calls the MQPUT? |
|
Back to top |
|
 |
mandy13 |
Posted: Tue Apr 23, 2013 7:31 pm Post subject: |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
MQPUT is not being called from the callback function.
The callback function only consumes the message from one topic and does the processing of the message received. The message consumer callback executes on another thread created by the system.
In the meanwhile we put some other data on another topic using MQPUT.
MQPUT gets called from the main thread.
Can we create two different connection handles of the same queue manager? If so what option do we need to set for MQCONNX? |
|
Back to top |
|
 |
mvic |
Posted: Wed Apr 24, 2013 1:07 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
mandy13 |
Posted: Thu Apr 25, 2013 10:01 pm Post subject: |
|
|
Apprentice
Joined: 17 Apr 2013 Posts: 28
|
Thanks for your reply guys,
I created two connections using MQCNO_HANDLE_SHARE_BLOCK as connection options. The code is now working.
Thanks a lot |
|
Back to top |
|
 |
|