Configure IBM MQ classes for JMS to use channel exits
An IBM MQ classes for JMS application can use channel security, send, and receive exits on the MQI channel that starts when the application connects to a queue manager. The application can use exits written in Java™, C, or C++. The application can also use a sequence of send or receive exits that are run in succession.
The following properties are used specify a send exit, or a sequence of send exits, used by a JMS connection:- The SENDEXIT property of an MQConnectionFactory object.
- The sendexit property on an activation specification used by the IBM MQ resource adapter for inbound communication,
- The sendexit property on a ConnectionFactory object used by the IBM MQ resource adapter for output communication.
- The name of a class that implements the WMQSendExit interface for a send exit written in Java.
- A string in the format libraryName (entryPointName) for a send exit written in C or C++.
- The RECEXIT property of an MQConnectionFactory object.
- The receiveexit property on an activation specification used by the IBM MQ resource adapter for inbound communication,
- The receiveexit property on a ConnectionFactory object used by the IBM MQ resource adapter for output communication.
- The SECEXIT property of an MQConnectionFactory object.
- The securityexit property on an activation specification used by the IBM MQ resource adapter for inbound communication,
- The securityexit property on a ConnectionFactory object used by the IBM MQ resource adapter for output communication.
For MQConnectionFactories, we can set the SENDEXIT, RECEXIT and SECEXIT properties by using the IBM MQ JMS administration tool or IBM MQ Explorer. Alternatively, an application can set the properties by calling the setSendExit(), setReceiveExit(), and setSecurityExit() methods.
Channel exits are loaded by their own class loader. To find a channel exit, the class loader searches the following locations in the specified order.- The class path specified by the property com.ibm.mq.cfg.ClientExitPath.JavaExitsClasspath or by the JavaExitsClassPath attribute in the Channels stanza of the IBM MQ client configuration file.
- The class path specified by the Java system property com.ibm.mq.exitClasspath. Note that this property is now deprecated.
- The IBM MQ exits directory, as shown in Table 1. The class loader first searches the directory for class files that are
not packaged in Java archive (JAR) files. If the
channel exit is not found, the class loader then searches the JAR files in the directory.
Table 1. The IBM MQ exits directory Platform Directory UNIX and Linux /var/mqm/exits (32-bit channel exits)
/var/mqm/exits64 (64-bit channel exits)
Windows install_data_dir\exits where install_data_dir is the directory chosen for the IBM MQ data files during installation. The default directory is C:\ProgramData\IBM\MQ.
The parent of the class loader is the class loader that is used to load IBM MQ classes for JMS. It is therefore possible for the parent class loader to load a channel exit if it cannot be found in any of the preceding locations. However, when you are using the IBM MQ classes for JMS in an environment such as a JEE application server, you are not likely to be able to influence the choice of the parent class loader and so the class loader should be configured by setting the Java system property com.ibm.mq.cfg.ClientExitPath.JavaExitsClasspath on the application server.
If our application is being run with the Java Security Manager enabled, then the policy configuration file used by the Java runtime environment that the application is running in must have the permissions to load a channel exit class. For information on how to do this, see Running IBM MQ classes for JMS applications under the Java Security Manager.
The MQSendExit, MQReceiveExit, and MQSecurityExit interfaces supplied with versions of IBM WebSphere MQ earlier than Version 7.0 are still supported. If we use channel exits that implement these interfaces, com.ibm.mq.jar must be present in the class path.
For information about how to write channel exits in C, see Channel-exit programs for messaging channels. You must store channel exit programs written in C or C++ in the directory shown in Table 1.If our application uses a client channel definition table (CCDT) to connect to a queue manager, see Use a client channel definition table with IBM MQ classes for JMS.