Callback - MQ_CALLBACK_EXIT
MQ_CALLBACK_EXIT provides an exit function to perform before and after callback processing. Use function identifier MQXF_CALLBACK with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after callback call exit functions.
The interface to this function is:MQ_CALLBACK_EXIT (&ExitParms, &ExitContext, &Hconn, &pMsgDesc, &pGetMsgOpts, &pBuffer, &pMQCBContext)where the parameters are:
- ExitParms (MQAXP) - input/output
- Exit parameter structure
- ExitContext (MQAXC) - input/output
- Exit context structure
- Hconn (MQHCONN) - input/output
- Connection handle
- pMsgDesc
- Message descriptor
- pGetMsgOpts
- Options that control the action of MQGET
- pBuffer
- Area to contain the message data
- pMQCBContext
- Context data for the callback
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 */ PMQMD pMsgDesc; /* Message descriptor */ PMQGMO pGetMsgOpts; /* Options that define the operation of the consumer */ PMQVOID pBuffer; /* Area to contain the message data */ PMQCBC pContext; /* Context data for the callback */The queue manager then logically calls the exit as follows:
MQ_SUBRQ_EXIT (&ExitParms, &ExitContext, &Hconn, &pMsgDesc, &pGetMsgOpts, &pBuffer, &pContext);Your exit must match the following C function prototype:
void MQENTRY MQ_CALLBACK_EXIT ( PMQAXP pExitParms; /* Exit parameter structure */ PMQAXC pExitContext; /* Exit context structure */ PMQHCONN pHconn; /* Connection handle */ PPMQMD ppMsgDesc; /* Message descriptor */ PPMQGMO ppGetMsgOpts; /* Options that define the operation of the consumer */ PPMQVOID ppBuffer; /* Area to contain the message data */ PPMQCBC ppContext;) /* Context data for the callback */
Usage notes
- The Callback exit is invoked before the consumer is invoked and after the consumer's consumer function has completed. Although the MQMD and MQGMO structures are alterable, changing the values in the before exit does not redrive the retrieval of a message from the queue as the message has already been removed from the queue to be delivered to the consumer function