The MQSeries control allows you to create your own send, receive, and security exits.
To implement an Exit, you must define a new Java class that implements the appropriate interface. Three exit interfaces are defined in the WebSphere MQ package:
The MQSeries MQSendExit interface allows you to examine and change the data sent to the queue manager by the WebSphere MQ Client for Java.
The MQSeries MQReceiveExit interface allows you to examine and change the data received from the queue manager by the WebSphere MQ Client for Java.
The MQSeries MQSecurityExit interface allows you to customize the security settings for connecting to a queue manager.
Notes: User Exits are supported for TCP connections only; they are not supported for bindings connections.
User Exits are used to modify the data that is transmitted between the MQSeries queue manager and the MQSeries client application. This data is in the form of MQSeries headers and does not involve the contents of the actual message being put and received from the queue.
To implement MQSeries Exits, perform the following tasks:
package com.bea.UserExit;
import com.ibm.mq.*;
public class MQUserExit implements MQSendExit, MQReceiveExit, MQSecurityExit {
public MQUserExit()
{
}
public byte[] sendExit(MQChannelExit channelExit,MQChannelDefinition channelDefnition,byte[] agentBuffer)
{
return agentBuffer;
}
public byte[] receiveExit(MQChannelExit channelExit,MQChannelDefinition channelDefnition,byte[] agentBuffer)
{
return agentBuffer;
}
public byte[] securityExit(MQChannelExit channelExit,MQChannelDefinition channelDefnition,byte[] agentBuffer)
{
return agentBuffer;
}
}
You may implement these interfaces in a single class or in separate classes, as required.
For an MQSendExit, the agentBuffer parameter contains the data to be sent. For an MQReceiveExit or an MQSecurityExit, the agentBuffer parameter contains the data just received.
For the MQSendExit and the MQSecurityExit, your exit code should return the byte array that you want to send to the server. For a Receive exit, your exit code must return the modified data that you want WebSphere MQ Client for Java to interpret.
set CLASSPATH=%ARDIR%\ant\ant.jar;%JAVA_HOME%\jre\lib\rt.jar
and append the following line to it:
Before you append the code containing the Jar file name to the CLASSPATH, you can define the directory in which the Jar file resides, as follows:
![]() |
![]() |