The exit entry point registration call (MQXEP)

Use this information to learn about MQXEP, MQXEP C language invocation, and MQXEP C function prototype.

Use the MQXEP call to:
  1. Register the before and after IBM MQ API exit invocation points at which to invoke exit functions
  2. Specify the exit function entry points
  3. Deregister the exit function entry points

You would typically code the MQXEP calls in the MQ_INIT_EXIT exit function, but we can specify them in any subsequent exit function.

If we use an MQXEP call to register an already registered exit function, the second MQXEP call completes successfully, replacing the registered exit function.

If we use an MQXEP call to register a NULL exit function, the MQXEP call completes successfully and the exit function is deregistered.

If MQXEP calls are used to register, deregister, and reregister a particular exit function during the life of a connection request, the previously registered exit function is reactivated. Any storage still allocated and associated with this exit function instance is available for use by the exit's functions. (This storage is typically released during the invocation of the termination exit function.)

The interface to MQXEP is:
MQXEP (Hconfig, ExitReason, Function, EntryPoint, &ExitOpts, &CompCode, &Reason)
where:

    Hconfig (MQHCONFIG) - input
    The configuration handle, representing the API exit that includes the set of functions being initialized. This value is generated by the queue manager immediately before invoking the MQ_INIT_EXIT function, and is passed in the MQAXP to each API exit function.

    ExitReason (MQLONG) - input
    The reason for which the entry point is being registered, from the following reasons:

    • Connection level initialization or termination (MQXR_CONNECTION)
    • Before an IBM MQ API call (MQXR_BEFORE)
    • After an IBM MQ API call (MQXR_AFTER)

    Function (MQLONG) - input
    The function identifier, valid values for which are the MQXF_* constants (see External constants ).

    EntryPoint (PMQFUNC) - input
    The address of the entry point for the exit function to be registered. The value NULL indicates either that the exit function has not been provided, or that a previous registration of the exit function is being deregistered.

    ExitOpts(MQXEPO)
    API exits can specify options that control how API exits are registered. If a null pointer is specified for this field, the default values of the MQXEPO structure are assumed.

    CompCode (MQLONG) - output
    The completion code, valid values for which are:

      MQCC_OK
      Successful completion.

      MQCC_FAILED
      Call failed.

    Reason (MQLONG) - output
    The reason code that qualifies the completion code. If the completion code is MQCC_OK:

      MQRC_NONE
      (0, X'000') No reason to report.

    If the completion code is MQCC_FAILED:

      MQRC_HCONFIG_ERROR
      (2280, X'8E8') The supplied configuration handle is not valid. Use the configuration handle from the MQAXP.

      MQRC_EXIT_REASON_ERROR
      (2377, X'949') The supplied exit function invocation reason is either not valid or is not valid for the supplied exit function identifier. Either use one of the valid exit function invocation reasons (MQXR_* value), or use a valid function identifier and exit reason combination. (See Table 1.)

      MQRC_FUNCTION_ERROR
      (2281, X'8E9') The supplied function identifier is not valid for API exit reason. The following table shows valid combinations of function identifiers and ExitReasons.

      Function ExitReason
      MQXF_INIT
      MQXF_TERM
      MQXR_CONNECTION
      MQXF_CONN
      MQXF_CONNX
      MQXF_DISC
      MQXF_OPEN
      MQXF_CLOSE
      MQXF_PUT1
      MQXF_PUT
      MQXF_GET
      MQXF_INQ
      MQXF_SET
      MQXF_BEGIN
      MQXF_CMIT
      MQXF_BACK
      MQXF_STAT
      MQXF_CB
      MQXF_CTL
      MQXF_CALLBACK
      MQXF_SUB
      MQXF_SUBRQ
      MQXR_BEFORE
      MQXR_AFTER
      MQXF_DATA_CONV_ON_GET MQXR_BEFORE

      MQRC_RESOURCE_PROBLEM
      (2102, X'836') An attempt to register or deregister an exit function has failed because of a resource problem.

      MQRC_UNEXPECTED_ERROR
      (2195, X'893') An attempt to register or deregister an exit function has failed unexpectedly.

      MQRC_PROPERTY_NAME_ERROR
      (2442, X'098A') Invalid ExitProperties name.

      MQRC_XEPO_ERROR
      (2507, X'09CB') Exit options structure not valid.


MQXEP C language invocation

MQXEP (Hconfig, ExitReason, Function, EntryPoint, &ExitOpts, &CompCode, &Reason);
Declaration for parameter list:
	MQHCONFIG       Hconfig;        /* Configuration handle */
	MQLONG          ExitReason;     /* Exit reason */
	MQLONG          Function;       /* Function identifier */
	PMQFUNC         EntryPoint;     /* Function entry point */
	MQXEPO          ExitOpts;       /* Options that control the action of MQXEP */
	MQLONG          CompCode;       /* Completion code */
	MQLONG          Reason;         /* Reason code qualifying completion
	                                   code */


MQXEP C function prototype

void MQXEP (
MQHCONFIG    Hconfig,        /* Configuration handle */
MQLONG       ExitReason,     /* Exit reason */
MQLONG       Function,       /* Function identifier */
PMQFUNC      EntryPoint,     /* Function entry point */
PMQXEPO      pExitOpts;      /* Options that control the action of MQXEP */
PMQLONG      pCompCode,      /* Address of completion code */
PMQLONG      pReason);       /* Address of reason code qualifying completion
                                code */ 
Parent topic: API exit reference