com.ibm.mq.exits

Interface WMQReceiveExit



  • public interface WMQReceiveExit
    The receive exit interface allows you to examine, and possibly alter, the data received from the queue manager by the WebSphere MQ Client 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.

    For example,

     
       // in MyReceiveExit.java
       package acme.exits;
       class MyReceiveExit implements WMQReceiveExit 
       {
           // you must provide an implementation of the channelReceiveExit method
           public ByteBuffer channelReceiveExit(MQCXP      channelExitParms,
                                      MQCD       channelDefinition,
                                      ByteBuffer agentBuffer)
           {
               // your exit code goes here...
           }
       }
     

    To use your receive exit with WebSphere MQ Classes for Java, create a new instance of your class and assign it to the MQEnvironment.channelReceiveExit field before constructing your MQQueueManager object.

    For example,

     
       // in your main program...
       MQEnvironment.channelReceiveExit = new acme.exits.MyReceiveExit();
       ...    // other initialisation
       MQQueueManager qMgr        = new MQQueueManager("");
      
     

    To use your receive exit with WebSphere MQ Classes for JMS, specify the name of the class using com.ibm.mq.jms.MQConnectionFactory.setReceiveExit() before getting a connection.

    For example,

     
       // in your main program...
       MQQueueConnectionFactory mqcf = new MQQueueConnectionFactory();
       mqcf.setReceiveExit("acme.exits.MyReceiveExit");
       // set the other parameters in the MQQueueConnectionFactory here...
       MQQueueConnection mqqc =(MQQueueConnection)mqcf.createQueueConnection();
      
     
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.nio.ByteBuffer channelReceiveExit(MQCXP channelExitParms, MQCD channelDefinition, java.nio.ByteBuffer agentBuffer)
      The receive exit method that your class must provide.
    • Method Detail

      • channelReceiveExit

        java.nio.ByteBuffer channelReceiveExit(MQCXP channelExitParms,
                                             MQCD channelDefinition,
                                             java.nio.ByteBuffer agentBuffer)
        The receive exit method that your class must provide. It is invoked whenever the WebSphere MQ Client for Java receives a message from 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 WebSphere 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 if channelExitParms.getExitReason() is CMQXC.MQXR_XMIT.
        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:
        MQCXP, MQCD
(c) Copyright IBM Corp. 2008, 2015. All Rights Reserved.