Package com.ibm.mq.exits
Interface WMQSendExit
public interface WMQSendExit
The send exit interface allows you to examine, and possibly alter, the data sent to the queue
manager by the IBM MQ Client for Java.
Note: This interface does not apply when connecting directly to IBM MQ in bindings mode.
To provide your own send exit, define a class that implements this interface.
For example,
// in MySendExit.java
package acme.exits;
class MySendExit implements WMQSendExit
{
// you must provide an implementation of the channelSendExit method
public ByteBuffer channelSendExit(MQCXP channelExitParms,
MQCD channelDefinition,
ByteBuffer agentBuffer)
{
// your exit code goes here...
}
}
To use your send exit with IBM MQ Classes for Java, create a new instance of your class and assign it to the com.ibm.mq.MQEnvironment.channelSendExit()field before constructing your MQQueueManager object.
For example,
// in your main program...
MQEnvironment.channelSendExit = new acme.exits.MySendExit();
... // other initialisation
MQQueueManager qMgr = new MQQueueManager("");
To use your send exit with IBM MQ Classes for JMS, specify the name of the class using com.ibm.mq.jms.MQConnectionFactory.setSendExit(String) before getting a connection.
For example,
// in your main program...
MQQueueConnectionFactory mqcf = new MQQueueConnectionFactory();
mqcf.setSendExit("acme.exits.MySendExit");
// set the other parameters in the MQQueueConnectionFactory here...
MQQueueConnection mqqc =(MQQueueConnection)mqcf.createQueueConnection();
-
Method Summary
Modifier and TypeMethodDescriptionchannelSendExit(MQCXP channelExitParms, MQCD channelDefinition, ByteBuffer agentBuffer) The send exit method that your class must provide.
-
Method Details
-
channelSendExit
The send exit method that your class must provide. It is invoked whenever the IBM MQ Client for Java sends a message to the queue manager.- Parameters:
channelExitParms- contains information about the context in which the exit is being invoked.channelExitParms.setExitResponse(int)sets a parameter which you use to tell the IBM MQ Client for Java what action to take next.channelDefinition- contains details of the channel through which all communications with the queue manager take place.agentBuffer- contains the data received from the queue manager ifchannelExitParms.getExitReason()is CMQXC.MQXR_XMIT. Otherwise pAgentBuffer is null.- Returns:
- pExitBuffer contains either a new or the original agentBuffer. This buffer will be passed on to subsequent exits in the exit chain.
- See Also:
-