Using Inbound Interface for Incoming message

About this task

By using MDB, the application can get the information of the arrival of inbound message. The MDB implements Lu62MessageListener interface and specifies the messaging-type and activation-config-property attributes in deployment descriptor of MDB.

The following is an example:

Deployment descriptor of example MDB:
<message-driven id="MDBtest2">
 <ejb-name>MDBtest2</ejb-name>
 <ejb-class>ejbs.MDBtest2Bean</ejb-class>
<messaging-type>
    com.ibm.connector2.sna.lu62.Lu62MessageListener
</messaging-type>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<activation-config>
       <activation-config-property>
              <activation-config-property-name>outgoing</activation-config-property-name>
              <activation-config-property-value>false</activation-config-property-value>
              </activation-config-property>
              <activation-config-property>
              <activation-config-property-name>tpName</activation-config-property-name>
              <activation-config-property-value>TPCDL</activation-config-property-value>
        </activation-config-property>
</activity-config>
</message-driven>
MDB bean class:
public class MDBtest2Bean  implements 
	javax.ejb.MessageDrivenBean,
		com.ibm.connector2.sna.lu62.Lu62MessageListener {
…….
public int onIncomingMessage(String msg, Lu62Conversation conversation) {
	// add the application implementation of handling the inbound message here
           // handling the message
           //send reply message back
             conversation.send(replyMessage);
}
……
}

Note that MDB is anonymous in nature. Therefore, it cannot be directly invoked by a client like session bean or entity bean. When the inbound message comes in, the LU62 Connector will deliver the message to message endpoint, and the onIncomingMessage method will be called by application server.