Author |
Message
|
tekn0wledg |
Posted: Wed Jan 15, 2003 10:33 am Post subject: Getting Messages After Connecting via MQCONNXAny |
|
|
Novice
Joined: 15 Jan 2003 Posts: 16
|
I have been successful in creating a connection to a remote queue manager, the problem is i cannot get any messages to return. i'm getting an invalid handle message 2019 when trying to use MQGET with the handle associated with the MSCONNXAny connection.
does anyone have any idea, or examples, on howto receive messages from any queue, once connected remotely? |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 20, 2003 6:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
IBM says the following about the 2019 return code:
Quote: |
MQRC_HOBJ_ERROR
The object handle Hobj is not valid. This reason also occurs if the parameter pointer is not valid, or (for the MQOPEN call) points to read-only storage. (It is not always possible to detect parameter pointers that are not valid; if not detected, unpredictable results occur.)
Corrective action: Ensure that a successful MQOPEN call is performed for this object, and that an MQCLOSE call has not already been performed for it. For MQGET and MQPUT calls, also ensure that the handle represents a queue object. Ensure that the handle is being used within its valid scope.
|
Have you issued an MQOPEN call before you issued your get command? Did it succeed?
There are sample programs available from the MQSeries install. There is also a software library here. |
|
Back to top |
|
 |
tekn0wledg |
Posted: Mon Jan 20, 2003 6:37 am Post subject: |
|
|
Novice
Joined: 15 Jan 2003 Posts: 16
|
yes i did issue an MQOPEN call after connecting. And i can query the queue and get back the Queue Manager name etc. the problem is, i guess i don't know how i am opening it for an MQGET. i try using the smae logic from the MQGET examples, but i get an invalid handle error.
any suggestions? |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 20, 2003 9:38 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What options are you specifying with the MQOpen call? What options are you specifying with the MQGet call?
Is the queue you are trying to access local to the queue manager you are connecting to? Is it a cluster queue? |
|
Back to top |
|
 |
tekn0wledg |
Posted: Mon Jan 20, 2003 1:53 pm Post subject: |
|
|
Novice
Joined: 15 Jan 2003 Posts: 16
|
it's not a cluster queue, and the queue manager is a remote queue, but the queue i am looking to access, is obviously local to that remote machine.
i will post my code tomorrow, as i don't have it here today due to the holiday. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 21, 2003 7:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The other thing to be aware of is that it is not possible to share a connection handle between two threads. That's what the manual means by 'Ensure that the handle is being used within its valid scope. '.
If you're opening the connection in one thread, and then doing the get in another, this would generate the error message you're seeing. |
|
Back to top |
|
 |
tekn0wledg |
Posted: Tue Jan 21, 2003 7:42 am Post subject: |
|
|
Novice
Joined: 15 Jan 2003 Posts: 16
|
not another thread, rather another function within the same module.
here is the code i am using:
i can connect successfully to the remote server via the following code, and query the Queue Manager name.
MQCONNXAny QmgrNameIn, CNOCD, Hcon, CompCode, Reason
MQOD_DEFAULTS od
od.ObjectType = MQOT_Q_MGR
MQOPEN Hcon, od, MQOO_INQUIRE + MQOO_FAIL_IF_QUIESCING, Hobj, CompCode, Reason
Selector = MQCA_Q_MGR_NAME
MQINQ Hcon, Hobj, 1, Selector, 0, 0, MQ_Q_MGR_NAME_LENGTH, QmgrNameOut, CompCode, Reason
This portion all works fine. Now what do i set the options to when using an MQGET?
i know this MQOPEN would be different for use with MQGET.... but what would it be? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 21, 2003 11:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
At a minimum, you need to include one of
MQOO_INPUT_AS_Q_DEF
MQOO_INPUT_SHARED
MQOO_INPUT_EXCLUSIVE
if you want to actually get any data from the queue.
So
MQOPEN Hcon, od, MQOO_INQUIRE + MQOO_FAIL_IF_QUIESCING+MQOO_INPUT_AS_Q_DEF, Hobj, CompCode, Reason |
|
Back to top |
|
 |
tekn0wledg |
Posted: Tue Jan 21, 2003 11:06 am Post subject: |
|
|
Novice
Joined: 15 Jan 2003 Posts: 16
|
ok i will try that tomorrow. thanks for the help. i will reply back notifying of whether this worked or not. |
|
Back to top |
|
 |
|