Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MQCONN question

Status
Not open for further replies.

bluecity

Programmer
Feb 16, 2001
3
US
I have two questions about the MQCONN function.
(1)
Assume a MQ Client and a MQServer are running on different machines.
When a program calls MQCONN(), does it do socket coneect job to make a connection to the MQ Server automatically?

(2)
I am maintaining a C++ program and found out that we made two MQCONN() calls to the same queue manager, but with different connection handle. It looks like the handle ONE is listening(calling mqget() function periodically) all the time. When the handle ONE gets the message size, the program creates a proper buffer and call mqget() function in handle TWO.
My question is :
can we call mqconn() twice to the same queue manager?

It looks like it should be YES, because my code shows it. But, why?
ps. according to the book, we will get a reason code of MQRC_ALREADY_CONNECTED.

Why the program calls the mqGet() function in the handle TWO, not in the handle ONE?


our psedo code is shown following:

(*m_pfnConnect)(m_QueueManagerName, &m_hMQSeriesConnection, &CompCode, &Reason);
(*m_pfnConnect)(m_QueueManagerName, &m_hListenerConnection, &CompCode, &Reason);

(*m_pfnGet)(m_hListenerConnection, m_hListenerQueue, &MessageDescriptor,
&MsgWaitingOptions, DummyMsgLength, m_listenBuffer, &MsgSize,
&CompCode, &Reason);
........
........
.......

(*m_pfnGet)(m_hMQSeriesConnection,
m_hReplyQueue,
&MessageDescriptor,
&GetMsgOptions,
MsgLength,
pMessage,
&MsgLength,
&CompCode,
&Reason);


THanks for your help
 
1) Yes - the QMgr runs a listener (or uses INETD) to start channel processes in response to incoming requests to TPC connect requests. If you use SNA the APPC listener effectively does the same thing

2) You can only connect to a single qmgr once within the same thread. Multiple threads can (and must) do separate MQCONNs if they both use MQ functions. Client programs can connect to multiple qmgrs simultaneously but directly connected program threads can only connect to one qmgr. Multiple connections yield the above message.

Cheers,
Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top