The following is an example:
<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>
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.