Invocation of the PreConnect exit module
The PreConnect exit module can be invoked with three different reason codes: the
MQXR_INIT reason code for initializing and establishing a connection to an LDAP server, the
MQXR_PRECONNECT reason code for retrieving channel definitions from an LDAP server, or the MQXR_TERM
reason code when the exit is to be cleaned.
- MQXR_INIT
- The exit is invoked with MQXR_INIT reason code for initializing and establishing a connection to
an LDAP server.
- Before the MQXR_INIT call, the pExitDataPtr field of the MQNXP structure is populated with the
Data attribute from the PreConnect stanza within the mqclient.ini file (that
is, the LDAP).
- An LDAP URL consists of at least the protocol, host name, 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 the
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 the 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 the
QMgrNameparameter contains a specific queue manager name, the search returns
all channel definitions for which the 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 for which the 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 the exit is to be cleaned. During this cleaning,
the exit disconnects from the LDAP server, and releases all the memory allocated and maintained by
the exit, including 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 an exit with the MQXR_TERM
reason code and may be NULL.
Parent topic: Sample program for Connection Endpoint Lookup (CEPL)
Related information