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 value of the property is a string that comprises one or more items separated by commas. Each item identifies a send exit in one of the following ways:
- 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++.
In a similar way, the following properties specify the receive exit, or sequence of receive exits, used by a connection:
- 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 following properties specify the security exit used by a connection:
- 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.
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 that you chose for the IBM MQ data files during installation. The default directory is C:\ProgramData\IBM\MQ.
Note: If a channel exit exists in more than one location, the IBM MQ classes for JMS loads the first instance that it finds.
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, we 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 the 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. We must store channel exit programs written in C or C++ in the directory shown in Table 1.If the 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.
Parent topic: Accessing IBM MQ features from an IBM MQ classes for JMS application