General usage notes

This section contains general usage notes that relate to all API exit functions.

  1. All exit functions can issue the  MQXEP  call; this call is designed specifically for use from API exit functions.
  2. The  MQ_INIT_EXIT  function cannot issue any MQ calls other than  MQXEP .
  3. All other exit functions can issue the following MQ calls:

     MQBACK ,  MQBEGIN ,  MQCLOSE ,  MQCMIT ,  MQCONN ,  MQCONNX ,  MQDISC ,  MQGET ,  MQINQ ,  MQOPEN ,  MQPUT ,  MQPUT1 ,  MQSET 

  4. If an exit function issues the  MQCONN  call, or the  MQCONNX  call with the MQCNO_HANDLE_SHARE_NONE option, the call completes with reason code MQRC_ALREADY_CONNECTED, and the handle returned is the same as the one passed to the exit as a parameter.
  5. If an exit function issues the  MQCONNX  call with the MQCNO_HANDLE_SHARE_BLOCK or MQCNO_HANDLE_SHARE_NO_BLOCK options, the call returns a new shared handle. This provides the exit suite with a connection handle of its own, and hence a unit of work that is independent of the application's unit of work. The exit suite can use this handle to put and get messages within its own unit of work, and commit or back out that unit of work; all of this can be done without affecting the application's unit of work in any way.

    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.

  6. Exit functions can also put and get messages within the application's unit of work. When the application commits or backs out the unit of work, all messages within the unit of work are committed or backed out together, regardless of who placed them in the unit of work (application or exit function). However, the exit can cause the application to exceed system limits sooner than would otherwise be the case (for example, by exceeding the maximum number of uncommitted messages in a unit of work).

    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.

  7. If an MQXR_BEFORE exit function terminates abnormally, the queue manager may be able to recover from the failure. If it can, the queue manager continues processing as though the exit function had returned MQXCC_FAILED. If the queue manager cannot recover, the application is terminated.
  8. If an MQXR_AFTER exit function terminates abnormally, the queue manager may be able to recover from the failure. If it can, the queue manager continues processing as though the exit function had returned MQXCC_FAILED. If the queue manager cannot recover, the application is terminated. Be aware that in the latter case, messages retrieved outside a unit of work are lost (this is the same situation as the application failing immediately after removing a message from the queue).



© IBM Corporation 1994, 2002. All Rights Reserved