Exit Module Invocation

The PreConnect exit module can be invoked with three different reason codes. This section describes each exit reason in greater depth.

MQXR_INIT
The exit is invoked with MQXR_INIT reason code for initializing and establishing connection to an LDAP server.
Before the MQXR_INIT call, the pExitDataPtr field of MQNXP structure would have been populated with the Data attribute from the PreConnect stanza within the mqclient.ini file (i.e. the LDAP).
An LDAP URL consists of at least the protocol, hostname, port number, and base DN for the search. The exit parses the LDAP URL contained within the pExitDataPtr field, allocates an MQNLDAPCTX LDAP Lookup Context structure and populates it accordingly. The address of this structure is stored in the pExitUserAreaPtr field. Failure to correctly parse the LDAP URL results in error MQCC_FAILED.
At this point the exit connects and binds to the LDAP server using the MQNLDAPCTX parameters. The resulting LDAP API handles are also stored within this structure.
MQXR_PRECONNECT
The exit module is invoked with MQXR_PRECONNECT reason code for retrieving channel definitions from an LDAP server.
The exit searches the LDAP server for channel definitions matching the given filter. If QMgrName parameter contains a specific queue manager name, then search returns all channel definitions whose ibm-amqQueueManagerName LDAP attribute value matches with the given queue manager name.
If the QMgrName parameter is '*' or ' '(blank), then the search returns all channel definitions whose ibm-amqIsClientDefault Connection endpoint attribute is set to true.
After a successful search, the exit prepares one or an array of MQCD definitions and returns back to the caller.
MQXR_TERM
The exit is invoked with this reason code when exit is to be cleaned. During this the exit disconnects from the LDAP server, releases all the memory allocated and maintained by the exit. This will include the MQNLDAPCTX structure, the pointer array and every MQCD it references. Any other fields are set to the default values. The pQMgrName and ppConnectOpts exit parameters are unused during MQXR_TERM and may be NULL.