MQReceiveExit

 



public interface MQReceiveExit
extends Object

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.

Note:
This interface does not apply when connecting directly to WebSphere MQ in bindings mode.

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 {
  //  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("");

 

Methods

receiveExit
public abstract byte[] receiveExit MQChannelExit(channelExitParms,
                           MQChannelDefinition channelDefinition,
                           byte agentBuffer[])

The receive exit method that your class must provide. This method is invoked whenever the WebSphere MQ classes for Java receives some data from the queue manager.

Parameters

channelExitParms
Contains information regarding the context in which the exit is being invoked. The exitResponse member variable is an output parameter that you use to tell the WebSphere MQ classes for Java what action to take next. See MQChannelExit for further details.

channelDefinition
Contains details of the channel through which all communications with the queue manager take place.

agentBuffer
If the channelExitParms.exitReason is MQChannelExit.MQXR_XMIT, agentBuffer contains the data received from the queue manager; otherwise agentBuffer is null.

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:

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.