The outbound message is sent by CCI verb ASYNC_SEND_RECEIVE, and
the replied inbound message is received in MDB.
Following is the deployment
descriptor of an 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>true</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>symbolicDestinationName</activation-config-property-name>
<activation-config-property-value>DSCCRIS0</activation-config-property-value>
</activation-config-property>
</activity-config>
</message-driven>
Note: The outgoing, symbolicDestinationName and tpName values
must match the values of these fields defined in J2C connection factory custom
properties.
The outbound code:
initialContext = new javax.naming.InitialContext();
connectionFactory = (ConnectionFactory) initialContext.lookup("snalu62");
Lu62ConnectionSpec lu62ConnectionSpec = new Lu62ConnectionSpec();
lu62ConnectionSpec.setUserName("sna");
lu62ConnectionSpec.setPassword("sna");
Connection cxn = connectionFactory.getConnection(lu62ConnectionSpec);
Interaction ixn = cxn.createInteraction();
Lu62InteractionSpec ixnSpec = new Lu62InteractionSpec();
Lu62Record outgoingData = new Lu62Record();
Lu62Record returnData = new Lu62Record();
ixnSpec.setInteractionVerb(ixnSpec.ASYNC_SEND_RECEIVE);
outgoingData.setData(requestData);
ixn.execute(ixnSpec, outgoingData, null);
ixn.close();
cxn.close();
The MDB handles the reply message for the outbound. The
following is the MDB bean class:
public class MDBtest2Bean implements
javax.ejb.MessageDrivenBean,
com.ibm.connector2.sna.lu62.Lu62MessageListener {
…….
public int onOutgoingReplyMessage (String msg) {
……..
// handling the reply message for outgoing message send by CCI
}
……
}