Example error handling for exit functions
The following diagram shows the points (eN) at which errors can occur. It is only an example to show how exits behave and should be read together with the following table. In this example, two exit functions are invoked both before and after each API call to show the behavior with chained exits.
Application ErrPt Exit function API call ----------- ----- ------------- -------- Start MQCONN --> e1 MQ_INIT_EXIT e2 before MQ_CONNX_EXIT 1 e3 before MQ_CONNX_EXIT 2 e4 --> MQCONN e5 after MQ_CONNX_EXIT 2 e6 after MQ_CONNX_EXIT 1 e7 <-- MQOPEN --> before MQ_OPEN_EXIT 1 e8 before MQ_OPEN_EXIT 2 e9 --> MQOPEN e10 after MQ_OPEN_EXIT 2 e11 after MQ_OPEN_EXIT 1 e12 <-- MQPUT --> before MQ_PUT_EXIT 1 e13 before MQ_PUT_EXIT 2 e14 --> MQPUT e15 after MQ_PUT_EXIT 2 e16 after MQ_PUT_EXIT 1 e17 <-- MQCLOSE --> before MQ_CLOSE_EXIT 1 e18 before MQ_CLOSE_EXIT 2 e19 --> MQCLOSE e20 after MQ_CLOSE_EXIT 2 e21 after MQ_CLOSE_EXIT 1 e22 <-- MQDISC --> before MQ_DISC_EXIT 1 e23 before MQ_DISC_EXIT 2 e24 --> MQDISC e25 after MQ_DISC_EXIT 2 e26 after MQ_DISC_EXIT 1 e27 <-- end
The following table lists the actions to be taken at each error point. Only a subset of the error points have been covered, as the rules shown here can apply to all others. It is the actions that specify the intended behavior in each case.
API exit errors and appropriate actions to take ErrPt Description Actions e1 Error while setting up environment setup.
- Undo environment setup as required
- Drive no exit functions
- Fail MQCONN with MQCC_FAILED, MQRC_API_EXIT_LOAD_ERROR
e2 MQ_INIT_EXIT function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Clean up environment
- Fail MQCONN with MQCC_FAILED, MQRC_API_EXIT_INIT_ERROR
- For MQXCC_*
- Act as for the values of MQXCC_* and MQXR2_*1
- Clean up environment
e3 Before MQ_CONNX_EXIT 1 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Drive MQ_TERM_EXIT function
- Clean up environment
- Fail MQCONN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*
- Act as for the values of MQXCC_* and MQXR2_*1
- Drive MQ_TERM_EXIT function if required
- Clean up environment if required
e4 Before MQ_CONNX_EXIT 2 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Drive after MQ_CONNX_EXIT 1 function
- Drive MQ_TERM_EXIT function
- Clean up environment
- Fail MQCONN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*
- Act as for the values of MQXCC_* and MQXR2_*1
- Drive after MQ_CONNX_EXIT 1 function if exit not suppressed
- Drive MQ_TERM_EXIT function if required
- Clean up environment if required
e5 MQCONN call fails.
- Pass MQCONN CompCode and Reason
- Drive after MQ_CONNX_EXIT 2 function if the before MQ_CONNX_EXIT 2 succeeded and the exit is not suppressed
- Drive after MQ_CONNX_EXIT 1 function if the before MQ_CONNX_EXIT 1 succeeded and the exit is not suppressed
- Drive MQ_TERM_EXIT function
- Clean up environment
e6 After MQ_CONNX_EXIT 2 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Drive after MQ_CONNX_EXIT 1 function
- Complete MQCONN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*
- Act as for the values of MQXCC_* and MQXR2_*1
- Drive after MQ_CONNX_EXIT 1 function if required
e7 After MQ_CONNX_EXIT 1 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED, complete MQCONN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*, act as for the values of MQXCC_* and MQXR2_*1
e8 Before MQ_OPEN_EXIT 1 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED, complete MQOPEN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*, act as for the values of MQXCC_* and MQXR2_*1
e9 Before MQ_OPEN_EXIT 2 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Drive after MQ_OPEN_EXIT 1 function
- Complete MQOPEN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*, act as for the values of MQXCC_* and MQXR2_*1
e10 MQOPEN call fails
- Pass MQOPEN CompCode and Reason
- Drive after MQ_OPEN_EXIT 2 function if exit not suppressed
- Drive after MQ_OPEN_EXIT 1 function if exit not suppressed and if chained exits not suppressed
e11 After MQ_OPEN_EXIT 2 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Drive after MQ_OPEN_EXIT 1 function
- Complete MQOPEN call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*
- Act as for the values of MQXCC_* and MQXR2_*1
- Drive after MQ_OPEN_EXIT 1 function if exit not suppressed
e25 After MQ_DISC_EXIT 2 function completes with:
- MQXCC_FAILED
- MQXCC_*
- For MQXCC_FAILED:
- Drive after MQ_DISC_EXIT 1 function
- Drive MQ_TERM_EXIT function
- Clean up exit execution environment
- Complete MQDISC call with MQCC_FAILED, MQRC_API_EXIT_ERROR
- For MQXCC_*
- Act as for the values of MQXCC_* and MQXR2_*1
- Drive MQ_TERM_EXIT function
- Clean up exit execution environment
- The values of MQXCC_* and MQXR2_* and their corresponding actions are defined in How queue managers process exit functions.
Parent topic:
What happens when exits fail
fg15050_