Scope of MQCONN or MQCONNX

 

Within WebSphere MQ for iSeries, WebSphere MQ on UNIX systems, and WebSphere MQ for Windows, the scope of an MQCONN or MQCONNX call is usually the thread that issued it. That is, the connection handle returned from the call is valid only within the thread that issued the call. Only one call can be made at any one time using the handle. If it is used from a different thread, it is rejected as invalid. If you have multiple threads in your application and each wants to use WebSphere MQ calls, each one must issue MQCONN or MQCONNX. Alternatively, consider Shared (thread independent) connections with MQCONNX.1

On WebSphere MQ for iSeries, WebSphere MQ on UNIX systems, and WebSphere MQ for Windows, each thread in an application can connect to different queue managers; on other systems, all concurrent connections within a process must be to the same queue manager.

If your application is running as a client, it can connect to more than one queue manager within a thread.

 

Parent topic:

Connecting to a queue manager using the MQCONN call

1 When using multithreaded applications with WebSphere MQ on UNIX systems we need to ensure that the applications have a sufficient stack size for the threads. You are recommended to use a stack size of 256KB, or larger, when multithreaded applications are making MQI calls, either by themselves or, with other signal handlers (for


fg12040_