The receive exit interface allows you to examine and possibly alter the data received from the queue manager by the WebSphere MQ classes for Java.
To provide your own receive exit, define a class that implements this interface. Create a new instance of your class and assign the MQEnvironment.receiveExit variable to it before constructing your MQQueueManager object. For example:
// in MyReceiveExit.java class MyReceiveExit implements MQReceiveExit { // you must provide an implementation // of the receiveExit method public byte[] receiveExit( MQChannelExit channelExitParms, MQChannelDefinition channelDefinition, byte[] agentBuffer) { // your exit code goes here... } } // in your main program... MQEnvironment.receiveExit = new MyReceiveExit(); ... // other initialization MQQueueManager qMgr = new MQQueueManager("");
public abstract byte[] receiveExit(MQChannelExit channelExitParms, MQChannelDefinition channelDefinition, byte agentBuffer[])
The receive exit method that your class must provide. This method will be invoked whenever the WebSphere MQ classes for Java receives some data from the queue manager.
Parameters
Returns
If the exit response code (in channelExitParms) is set so that the WebSphere MQ classes for Java can now process the data (MQXCC_OK), your receive exit method must return the data to be processed. The simplest receive exit, therefore, consists of the single line "return agentBuffer;".
See also: