This section contains general usage notes that relate to all API exit functions.
MQBACK , MQBEGIN , MQCLOSE , MQCMIT , MQCONN , MQCONNX , MQDISC , MQGET , MQINQ , MQOPEN , MQPUT , MQPUT1 , MQSET
Because the exit function is using a connection handle that is different from the handle being used by the application, MQ calls issued by the exit function result in the relevant API exit functions being invoked. Exit functions can therefore be invoked recursively. Note that both the ExitUserArea field in MQAXP and the exit chain area have connection-handle scope. Consequently, an exit function cannot use those areas to signal to another instance of itself invoked recursively that it is already active.
When an exit function uses the application's unit of work in this way, the exit function should usually avoid issuing the MQCMIT call, as this commits the application's unit of work and may impair the correct functioning of the application. However, the exit function may sometimes need to issue the MQBACK call, if the exit function encounters a serious error that prevents the unit of work being committed (for example, an error putting a message as part of the application's unit of work). In this situation the exit function must set the appropriate values to ensure that completion code MQCC_FAILED and reason code MQRC_BACKED_OUT are returned to the application, so that the application can detect the fact that the unit of work has been backed out.
If an exit function uses the application's connection handle to issue MQ calls, those calls do not themselves result in further invocations of API exit functions.