Get - MQ_GET_EXIT
MQ_GET_EXIT provides a get exit function to perform before and after MQGET call processing.
There are two function identifiers:- Use MQXF_GET with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQGET call exit functions.
- See MQXF_DATA_CONV_ON_GET for information on using the MQXF_DATA_CONV_ON_GET function identifier.
The interface to this function is:
MQ_GET_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &pMsgDesc, &pGetMsgOpts, &BufferLength, &pBuffer, &pDataLength, &CompCode, &Reason)where the parameters are:
- ExitParms (MQAXP) - input/output
- Exit parameter structure.
- ExitContext (MQAXC) - input/output
- Exit context structure.
- Hconn (MQHCONN) - input
- Connection handle.
- Hobj (MQHOBJ) - input/output
- Object handle.
- pMsgDesc (PMQMD) - input/output
- Pointer to message descriptor.
- pGetMsgOpts (PMQGMO) - input/output
- Pointer to get message options.
- BufferLength (MQLONG) - input/output
- Message buffer length.
- pBuffer (PMQBYTE) - input/output
- Pointer to message buffer.
- pDataLength (PMQLONG) - input/output
- Pointer to data length field.
- CompCode (MQLONG) - input/output
- Completion code, valid values for which are:
- MQCC_OK
- Successful completion.
- MQCC_WARNING
- Partial completion.
- MQCC_FAILED
- Call failed
- Reason (MQLONG) - input/output
- Reason code qualifying the completion 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 language invocation
The queue manager logically defines the following variables:MQAXP ExitParms; /* Exit parameter structure */ MQAXC ExitContext; /* Exit context structure */ MQHCONN Hconn; /* Connection handle */ MQHOBJ Hobj; /* Object handle */ PMQMD pMsgDesc; /* Ptr to message descriptor */ PMQPMO pGetMsgOpts; /* Ptr to get message options */ MQLONG BufferLength; /* Message buffer length */ PMQBYTE pBuffer; /* Ptr to message buffer */ PMQLONG pDataLength; /* Ptr to data length field */ MQLONG CompCode; /* Completion code */ MQLONG Reason; /* Reason code */The queue manager then logically calls the exit as follows:
MQ_GET_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &pMsgDesc, &pGetMsgOpts, &BufferLength, &pBuffer, &pDataLength, &CompCode, &Reason)Your exit must match the following C function prototype:
void MQENTRY MQ_GET_EXIT ( PMQAXP pExitParms, /* Address of exit parameter structure */ PMQAXC pExitContext, /* Address of exit context structure */ PMQHCONN pHconn, /* Address of connection handle */ PMQHOBJ pHobj, /* Address of object handle */ PPMQMD ppMsgDesc, /* Address of ptr to message descriptor */ PPMQGMO ppGetMsgOpts, /* Address of ptr to get message options */ PMQLONG pBufferLength, /* Address of message buffer length */ PPMQBYTE ppBuffer, /* Address of ptr to message buffer */ PPMQLONG ppDataLength, /* Address of ptr to data length field */ PMQLONG pCompCode, /* Address of completion code */ PMQLONG pReason); /* Address of reason code qualifying completion code */
Usage notes
- The MQ_GET_EXIT function interface described here is used for both the MQXF_GET exit function and the MQXF_DATA_CONV_ON_GET exit function.
Separate entry points are defined for these two exit functions, so to intercept both the MQXEP call must be used twice; for this call use function identifier MQXF_GET.
Because the MQ_GET_EXIT interface is the same for MQXF_GET and MQXF_DATA_CONV_ON_GET, a single exit function can be used for both; the Function field in the MQAXP structure indicates which exit function has been invoked. Alternatively, the MQXEP call can be used to register different exit functions for the two cases.
Parent topic: Exit functions