How you use API exits
How to configure WebSphere MQ for API exits
You configure WebSphere MQ to enable API exits by changing the configuration information in the usual ways:
In either case, you provide information to:
- Name the API exit
- Identify the module and entry point of the API exit code to run
- Optionally pass data with the exit
- Identify the sequence of this exit in relation to other exits
For detailed information on this configuration, see Configuring API exits. For a description of how API exits run, see What happens when an API exit runs?.
How to write an API exit
This section introduces writing API exits. For detailed information, aimed at application programmers, see the WebSphere MQ Application Programming Guide.
You write your exits using the C programming language. To help you do so, we provide a sample exit, amqsaxe0, that generates trace entries to a named file. When you start writing exits, we recommend that you use this as your starting point.
Exits are available for every API call, as follows:
- MQCONN/MQCONNX, to provide a queue manager connection handle for use on subsequent API calls
- MQDISC, to disconnect from a queue manager
- MQBEGIN, to begin a global unit of work (UOW)
- MQBACK, to back out a UOW
- MQCMIT, to commit a UOW
- MQOPEN, to open an MQSeries resource for subsequent access
- MQCLOSE, to close an MQSeries resource that had previously been opened for access
- MQGET, to retrieve a message from a queue that has previously been opened for access
- MQPUT1, to place a message on to a queue
- MQPUT, to place a message on to a queue that has previously been opened for access
- MQINQ, to inquire on the attributes of an MQSeries resource that has previously been opened for access
- MQSET, to set the attributes of a queue that has previously been opened for access
Within API exits, these calls take the general form:
MQ_call_EXIT (parameters)where call is the API call name (PUT, GET, and so on), and the parameters control the function of the exit, primarily providing communication between the exit and the external control blocks MQAXP (the exit parameter structure) and MQAXC (the exit context structure).
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.