JCA Listener Service and Sterling B2B Integration Resource Adapter
The JCA Listener service and Sterling B2B Integration Resource adapter works together to integrate Sterling B2B Integration with your legacy systems.
The following table provides an overview of the JCA Listener service:
System name | SI_JCA_ADAPTER |
---|---|
Graphical Process Modeler (GPM) category | None |
Description | Listens for incoming requests from Java Connector Architecture™ (JCA) requests. Runs business processes and returns resultant documents. A JCA Resource adapter (for Sterling B2B Integration, called the Sterling B2B Integration Resource adapter) is a standard mechanism in J2EE™ for supplying connectivity to remote enterprise integration systems from an application server. The JCA Listener service receives information from the Sterling B2B Integration Resource adapter and starts a business process. |
Business usage | The Sterling B2B Integration Resource adapter is deployed in two parts: one in a remote application server, the other in Sterling B2B Integration. This enables you to use an Enterprise Java Bean (EJB) that you write to start Sterling B2B Integration business processes directly from your application server. You can also pass documents to Sterling B2B Integration for processing and retrieve documents from Sterling B2B Integration. This enables you to integrate Sterling B2B Integration into your existing systems. |
Usage example | A legacy system running on an application server (for example, JBoss™ or WebLogic®) contains data such as a purchase order or bill of materials. The legacy system can run a business process in Sterling B2B Integration and pass documents into Sterling B2B Integration for processing. The legacy system can also retrieve the results of the processing from Sterling B2B Integration. |
Preconfigured? | No |
Requires third-party files? | Application server must have j2ee.jar (v1.3.1) in its classpath. |
Platform availability | All supported Sterling B2B Integration platforms |
Related services | The JCA Listener service is designed to work with the Sterling B2B Integration Resource adapter for Sterling B2B Integration, which is deployed in an application server. |
Application requirements | The Resource adapter (v 1.0) for Sterling B2B Integration must be deployed in an application server before using the JCA Listener service. |
Initiates business processes? | This adapter starts business processes requested through the JCA Listener service on the remote application server. You integrate the remote application with an EJB written to access Sterling B2B Integration through the JCA Listener service. |
Invocation | Does not run by a business process. |
Business process context considerations | Any text nodes placed under the message_to_child node at the top of ProcessData will be returned to the calling EJB. |
Returned status values | If this adapter starts from a business process, it will return an error. The completed business process returns the process ID to the Listener, which then allows for using the PID to query for the status, and to retrieve process data or documents. |
Restrictions | There may be multiple configurations of this adapter, but each must listen on a unique port. |
Requirements
- JCA specification
- Enterprise Java Beans
- XML concepts
- How process data and documents are handled in Sterling B2B Integration
- You have deployed the Sterling B2B Integration Resource adapter in an external application server.
- You have installed and configured the JCA Listener service in Sterling B2B Integration.
- The files j2ee.jar (version 1.3.1 or higher) is in the application server classpath.
How the Sterling B2B Integration Resource Adapter Works
The Sterling B2B Integration Resource adapter is deployed in a remote application server. This enables you to use a custom-written Enterprise Java Bean (EJB) to run a business process inside Sterling B2B Integration. You can also pass documents to Sterling B2B Integration for processing and retrieve documents from Sterling B2B Integration. This enables you to integrate Sterling B2B Integration into your existing systems.
The Sterling B2B Integration Resource adapter and the JCA Listener service can be configured to run in synchronous or asynchronous mode.
- A legacy system running on an external application server has a document that requires processing by Sterling B2B Integration.
- The legacy system uses an EJB you write to specify the Sterling B2B Integration business process to run and to pass the document to the Sterling B2B Integration Resource adapter.
- The Sterling B2B Integration Resource adapter transfers the document and the name of the business process to run to the JCA Listener service running in Sterling B2B Integration.
- The JCA Listener service starts the specified business process and passes it the input document.
- When the business process is completed, the resultant document is returned to the Sterling B2B Integration Resource adapter and back to the EJB.
Using the asynchronous mode of communication, you can run a predefined Sterling B2B Integration business process without waiting for the business process to complete. In this case, you can go back at some later time to retrieve resulting documents and status.
The following figure shows how the Sterling B2B Integration Resource adapter, running on an external application server, interacts with the JCA Listener service running on Sterling B2B Integration.
Limitations to Full JCA Specification Support
- Non-managed two-tier application scenarios, that is, applications that are not managed by an application server
- Transactions
- Connection pooling, in the traditional sense, as the adapter does not persist any live connections
Sample Business Scenario
This section describes a sample business scenario involving the JCA adapter.
- Write the necessary business process in Sterling B2B Integration.
- Configure the Sterling B2B Integration Resource adapter to work with your legacy billing system server.
- Write an EJB that passes the file from the legacy billing system to the Sterling B2B Integration Resource adapter, and specifies the business process to run in Sterling B2B Integration.
- Identify a free port on the server for the JCA Listener service to listen on.
- Create a JCA Listener service configuration. For information, see Managing Services and Adapters.
- Configure the JCA Listener service. For information, see Configuring the JCA Listener Service.
- Enable the JCA Listener service and Sterling B2B Integration Resource adapter.
- When your billing system produces a file to be sent to Sterling B2B Integration, the EJB picks up the file from the legacy system and passes it and the business process name to the Sterling B2B Integration Resource adapter.
- The Sterling B2B Integration Resource adapter passes the file and business process name to the JCA Listener service.
- The business process starts, runs successfully, and puts the results in the business process context.
- The response is passed back from the JCA Listener service to the Sterling B2B Integration Resource adapter, then to the legacy system.
Implementing the Sterling B2B Integration Resource Adapter
- Deploy the Sterling B2B Integration Resource adapter on your application server.
- Configure the Sterling B2B Integration Resource adapter using your application server administrator console or by editing the application server deployment descriptors.
- Make classpath changes to support compiling external J2EE components.
- Create a JCA Listener service configuration. For information, see Managing Services and Adapters.
- Configure the JCA Listener service. For information, see Configuring the JCA Listener
Service.
You can configure multiple instances of this adapter, each one on a unique port.
- Use the JCA Listener service in a business process.
Installed Location
The resource adapter (RAR) file containing the resource adapter implementation and the deployment descriptors is available under the client/jca subdirectory. The RAR files for deploying in JBoss and in WebLogic application servers are under the JBoss and WebLogic subdirectories, respectively.
JBoss Deployment
- sijca-service.xml – JBoss deployment descriptor for the resource adapter.
- sijca_<version>_jboss.rar – Contains the resource adapter implementation classes and the standard deployment descriptor, ra.xml.
The Resource adapter can then be accessed through the JBoss JMX console.
WebLogic Deployment
To deploy the Sterling B2B Integration Resource adapter in a WebLogic application server, the resource adapter (RAR file) must be packaged in an Enterprise Archive (EAR) file along with the J2EE component that will access it. It must be deployed as an EAR application to establish that the CCI classes are loaded and accessible to the J2EE component.
- ra.xml – The standard deployment descriptor for the Resource adapter
- weblogic-ra.xml – The WebLogic deployment descriptor for the Resource adapter
- Resource adapter implementation classes
Alternatively, si_jca_<version>_client.jar can be added to the WebLogic system classpath. In that case, deployment of new versions of the resource adapter will require an application server restart. To leverage the hot-deploy capability of the WebLogic server, it is recommended that the Resource adapter be deployed as part of an EAR application.
The Resource adapter can be accessed and configured through the WebLogic server administrator console.
Configuration
- HostName – The host machine where the targeted Sterling B2B Integration instance is running
- PortNumber – The port number where the JCA Listener service configuration is running
These parameters can be configured through the application server administrator consoles, or by editing the Resource adapter deployment descriptors (sijca-service.xml for JBoss, and weblogic-ra.xml for WebLogic).
The user name and password for authenticating the user must be provided through the ConnectionSpec when starting getConnection() on the ConnectionFactory.
Classpath Changes
To compile the external J2EE components that will access the Sterling B2B Integration Resource adapter, si_jca_<version>_client.jar (under client/jca) has to be added to the classpath. The javadoc for these CCI (Common Client Interface) classes is available under the client/jca/javadoc subdirectory.
Configuring the JCA Listener Service
To configure the JCA Listener service, you must specify settings for the following fields in Sterling B2B Integration:
Field | Description |
---|---|
Name | Unique and meaningful name for the service configuration. Required. |
Description | Meaningful description for the service configuration, for reference purposes. Required. |
Select a Group | Select one of the options:
Note: For more information about groups, see Managing Services
and Adapters.
|
Listen Port(listenPort) | Port number that this instance of the adapter will listen on. This port must be a free port. Numeric. Valid values are 1025 - 65535. Required. |
Functions Supported for Sterling B2B Integration
- Running a business process with or without an input document, and with or without input process
data
To run a business process in Sterling B2B Integration:
- Set the operationName in the SIInteractionSpec to InvokeBusinessProcess.
- To specify synchronous or asynchronous invocation, set the operationMode in the InteractionSpec
as follows:
To run the business process synchronously, set the operationMode to InteractionSpec.SYNC_SEND_RECEIVE
To run the business process asynchronously, set the operationMode to InteractionSpec.SYNC_SEND
- Retrieving documents and output process data from completed business processes
Any process data parameters that are included inside a message_to_child xml tag in process data of the business process that is running are returned as output process data. In the following example, param1 and param2 are returned as output process data, but not param3.
<process_data> <message_to_child> <param1>ValueOfParam1</param1> <param2>ValueOfParam2</param2> </message_to_child> … <param3>ValueOfParam3</param3> … </process_data>
To retrieve a document and/or output process data from a completed business process, set the operationName to GetBusinessProcessContext; operationMode is disregarded for this operation.
- Retrieving the state of a business process.
To retrieve the state of a business process, set the operationName to GetBusinessProcessState; operationMode is disregarded for this operation.
Code Example
- Look up the Resource Adapter Connection
Factory:
InitialContext iniCtx = new InitialContext(); /* / For JBoss Object ref = iniCtx.lookup("java:/SI"); */ // For WebLogic Object ref = iniCtx.lookup("eis/SI"); System.out.println("Found ConnectionFactory - " + ref.getClass().getName()); cf = (SIConnectionFactory) ref; System.out.println("Found ConnectionFactory");
- Make a connection. At this point, the Sterling B2B Integration Resource adapter connects to the JCA Listener service on Sterling B2B Integration, authenticates the user, and disconnects.
The user name and password come from the Sterling B2B Integration Accounts
area:
SIConnectionSpec info = new SIConnectionSpec("admin","password"); Connection conn = cf.getConnection(info); System.out.println("Created Connection #1"); Interaction interaction = conn.createInteraction();
- Create an InteractionSpec defining the operation to be run and the mode of
operation.
InteractionSpec interSpec = new SIInteractionSpec( SIInteractionSpec.OP_INVOKE_BP, InteractionSpec.SYNC_SEND_RECEIVE);
- Create a MappedRecord and set the required input
data.
MappedRecord inRec = new SIMappedRecord(); inRec.setRecordName("InputRecord"); inRec.setRecordShortDescription("Input record");
- Set the following for passing an input
document:
inRec.put(SIMappedRecordKeys.DOC_NAME, "DocName"); inRec.put(SIMappedRecordKeys.DOC_SUBJECT, "DocSubject"); inRec.put(SIMappedRecordKeys.DOC_TYPE, "text"); inRec.put(SIMappedRecordKeys.DOC_SUBTYPE, "plain"); inRec.put(SIMappedRecordKeys.DOC_ENCODING, "UTF-8"); String docBody = new String("This is the body of the test document"); inRec.put(SIMappedRecordKeys.DOC_BODY, docBody.getBytes());
- Pass any input process data as
follows:
Hashtable processData = new Hashtable(); processData.put("processData1", "process data value 1"); processData.put("processData2", "process data value 2"); inRec.put(SIMappedRecordKeys.PROCESS_DATA, processData);
- Set the name of the business process to
run.
inRec.put(SIMappedRecordKeys.INVOKE_BP_NAME, "BoomerangJCA");
- Execute the
operation.
MappedRecord outRec = (MappedRecord)interaction.execute(interSpec,inRec);
- Retrieve the output process data. Only parameters that are inside a message_to_child node in
process data will be
returned.
Hashtable pd = (Hashtable) outRec.get(SIMappedRecordKeys.PROCESS_DATA); Enumeration pdKeys = pd.keys(); while (pdKeys.hasMoreElements()) { System.out.println("Process Data key = " + pdKeys.nextElement()); };
- Release the connection.
interaction.close(); conn.close();