JCA Resource Adapters that support inbound communication depend on deployment of a Message-Driven Bean (MDB). To develop an application utilizing a JCA Adapter for inbound communication, the JCA Message-Drive Bean wizard must be used. When the wizard is finished, the message driven bean code skeleton is generated. For example, for the File JCA Adapter, the following MDB code skeleton is created:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import javax.ejb.MessageDriven;
import com.stc.connector.fileadapter.eway.FileListener;
import com.stc.connector.framework.eway.FaultException;
import com.stc.connector.framework.eway.InboundException;
/**
*
* @author SUN
*/
@MessageDriven(name="test.FileJCAMessageBean")
public class FileJCAMessageBean implements FileListener {
public FileJCAMessageBean() {
}
public void onContents(byte[] data, String encoding) throws FaultException,
InboundException {
// implement listener interface here
}
}
The MDB generated implements the associated Listener interface for the JCA Adapter specified in the JCA Message-Driven Bean wizard. In the case of File JCA Adapter, the FileListener interface is implemented.