Referencing connection definitions using a pre-connect exit from a repository
IBM MQ MQI clients can be configured to look up a repository to obtain connection definitions using a pre-connect exit library.
Introduction
A client application can connect to a queue manager using client channel definition tables (CCDT). Generally, the CCDT file is located on a central network file server, and have clients referencing it. Since it is difficult to manage and administer various client applications referencing the CCDT file, a flexible approach is to store the client definitions in a global repository like an LDAP directory, a WebSphere Registry and Repository or any other repository. Storing the client connection definitions in a repository makes managing client connection definitions easier, and applications can access the correct and most current client connection definitions.
During the MQCONN/X call execution, the IBM MQ MQI client loads an application specified pre-connect exit library, and invokes an exit function to retrieve connection definitions. The retrieved connection definitions are then used to establish connection to a queue manager. The details of exit library and function to invoke are specified in the mqclient.ini configuration file.
Syntax
void MQ_PRECONNECT_EXIT (pExitParms, pQMgrName, ppConnectOpts, pCompCode, pReason);
Parameters
- pExitParms
- Type: PMQNXP input /output
The PreConnection exit parameter structure.
The structure is allocated and maintained by the caller of the exit.
- pQMgrName
- Type: PMQCHAR input/output
Name of the queue manager.
On input, this parameter is the filter string supplied to the MQCONN API call through the QMgrName parameter. This field might be blank, explicit, or contain certain wildcard characters. The field is changed by the exit. The parameter is NULL when the exit is called with MQXR_TERM.
- ppConnectOpts
- Type: ppConnectOpts input/output
Options that control the action of MQCONNX.
This is a pointer to an MQCNO connection options structure that controls the action of the MQCONN API call. The parameter is NULL when the exit is called with MQXR_TERM. The MQI client always provides an MQCNO structure to the exit, even if it was not originally provided by the application. If an application provides an MQCNO structure, the client makes a duplicate to pass it to the exit where it is modified. The client retains the ownership of the MQCNO.
An MQCD referenced through the MQCNO takes precedence over any connection definition provided through the array. The client uses the MQCNO structure to connect to the queue manager and the others are ignored.
- pCompCode
- Type: PMQLONG input/output
Completion code.
Pointer to an MQLONG that receives the exits completion code. It must be one of the following values:
- MQCC_OK - Successful completion
- MQCC_WARNING - Warning (partial completion)
- MQCC_FAILED - Call failed
- pReason
- Type: PMQLONG input/output
Reason qualifying pCompCode.
Pointer to an MQLONG that receives the exit reason code. If the completion code is MQCC_OK, the only valid value is:
- MQRC_NONE - (0, x'000') No reason to report.
If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.
C Invocation
void MQ_PRECONNECT_EXIT (&ExitParms, &QMgrName, &pConnectOpts, &CompCode, &Reason);ParameterPMQNXP pExitParms /*PreConnect exit parameter structure*/ PMQCHAR pQMgrName /*Name of the queue manager*/ PPMQCNO ppConnectOpts/*Options controlling the action of MQCONNX*/ PMQLONG pCompCode /*Completion code*/ PMQLONG pReason /*Reason qualifying pCompCode*/Parent topic: User exits, API exits, and IBM MQ installable services