Runtime tools : Service components : JCA SNA Connector : JCA SNA LU0 Connector : Tasks : JCA LU0 Sample Code : Inbound communication for solicited message
  
Inbound communication for solicited message
CCI verb ASYNC_SEND_RECEIVE send the outbound message, and the replied inbound message is received by MDB.
The outbound code:
initialContext = new javax.naming.InitialContext();
connectionFactory = (ConnectionFactory) initialContext.lookup("snalu0");
Lu0ConnectionSpec lu0ConnectionSpec = new Lu0ConnectionSpec();
lu0ConnectionSpec.setUserName("sna");
lu0ConnectionSpec.setPassword("sna");
Connection cxn = connectionFactory.getConnection(lu0ConnectionSpec);
Interaction ixn = cxn.createInteraction();
Lu0InteractionSpec ixnSpec = new Lu0InteractionSpec();
Lu0Record outgoingData = new Lu0Record();
Lu0Record returnData = new Lu0Record();
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 outbound. 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.lu0.Lu0MessageListener
</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>LuName</activation-config-property-name>
<activation-config-property-value>LUEE003</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>HostApplicationName</activation-config-property-name>
<activation-config-property-value>CICS</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.lu0.Lu0MessageListener {
…….
public int onSolicitedMessage(String msg) {
// add the application implementation of handling the inbound message here


}
……
}
Go up to
JCA LU0 Sample Code