The MQSeries control allows you to provide your own send, receive, and security exits.
To implement an exit, you 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 possibly alter the data sent to the queue manager by the WebSphere MQ Client for Java.
The MQSeries MQReceiveExit interface allows you to examine and possibly alter the data received from the queue manager by the WebSphere MQ Client for Java.
The MQSeriesSecurityExit interface allows you to customize the security flows that occur when an attempt is made to connect 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.
In order 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 a Send exit, the agentBuffer parameter contains the data that is about to be sent. For a Receive exit or a Security exit, the agentBuffer parameter contains the data that has just been received.
For the Send and Security exits, 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:
![]() |
![]() |