An import with a messaging binding such as JMS or MQ or MQ JMS that exchanges messages with an export with a messaging binding could be considered as messaging clients to each other. In order for your service component architecture (SCA) application to communicate to an existing JMS, MQ or MQ JMS messaging client, certain SCA artifacts need to be created. In this section, we will provide some guidance and steps on how to create a business object and an interface that would represent your messaging client application in an SCA manner. Imports, exports and bindings are also discussed. SCA applications use imports with messaging bindings to send messages to messaging clients and use exports with messaging bindings to receive messages from messaging clients.
Prerequisite: There exists a module that contains your service component architecture application and the message format used by the JMS, MQ or MQ JMS client is known.
In order for your SCA application to communicate to an existing messaging client, you will need to have a business object that would represent the message that is used by the messaging client.
If the message that is used by the client is in XML format, the XML schema that defines it would be used as your business object. If you have this schema, you will need to import it into your module. The imported XML schema would appear under Data Types in your module. If you do not have this schema, you can create a business object and add the appropriate attributes to it that will mirror the XML format used by the client.
If the message that is used by the client is not in XML format and there is no XML schema that defines it, you will have to create a business object and add the appropriate attributes to it so that it reflects logically the message format used by the JMS client. For example, if the message format is a JavaBean, you would create a business object and add appropriate attributes to the business object to represent the attributes of the JavaBean.
JMS provides a message class that can have one of five body types containing the message in a different format. WebSphere Integration Developer supports this message class. To reduce your development time, WebSphere Integration Developer provides a feature in its dependency editor to generate appropriate business objects for each of these JMS body types.
To create the business object, right click on Data Types in your module, and select New > Business Object from the context menu. Specify an appropriate name for your business object and click Finish. Add the appropriate attributes to your business object to fully describe it, and save.
Data bindings, which are discussed later, handle the transformation of data passed in native format from a messaging system or EIS system to a Service Data Object (SDO) in a Service Component Architecture-based (SCA) application.
In addition to the business object, in order for your SCA application to communicate to an existing messaging client, you will need to have an interface that would represent the input and output of the messaging client application; that is, the interface represents the interaction with the client.
The interface will have business operations to describe the messaging client application operations. The operation style, such as document literal wrapped, document literal or RPC, to be implemented needs to be decided. An operation may be one-way, sending a message and not expecting a response, or request-response, sending a message and expecting a returning message.
The type of the operation would be the type of the business object that represents the message used by the messaging client. For example, in the case of employee information, an employeeRecord business object should be used or created. Based on the content of the employee information, it may cause an employee record to be created, or an existing employee record to be updated or deleted. So on the interface, you could have three operations: createEmployeeRecord, updateEmployeeRecord, and deleteEmployeeRecord.
To create the interface, right-click on Interfaces in the navigation of your module, and select New > Interface from the context menu. Specify an appropriate name for the interface and click Finish. Add the appropriate operations to your interface to fully describe the interaction with the messaging client and save.
A business object represents the message received and sent from the JMS, MQ or MQ JMS messaging client and an interface represents the interaction of the input and output of the messaging client. But how is the data transferred between the client and these SCA artifacts? Business objects and interfaces are found in a module, which is similar to a project container. Imports and exports define a module's external interfaces or access points. In other words, the messaging client interacts with an SCA application's business objects and interfaces through imports and exports.
Imports identify services outside of a module that can be called from within the module. Exports allow components to listen to requests from external clients. An export allows an external event to be processed. When a message is put on a destination, the associated SCA export will process the event invoking the targeted SCA component. With respect to messaging, imports and exports work as a pair to send and receive messages. An import allows an internal event in the SCA application to be processed. When such a message is put on a destination queue, the associated messaging client will process the event. When a message is put on a destination queue, the associated SCA export will process the event invoking the targeted SCA component.
Binding information, which specifies the means of transporting the data from the modules, is required for an import or an export. Several messaging bindings are available including JMS, MQ and MQ JMS bindings.
The relationship of bindings, messages in the context of imports and exports, and types of operations in interfaces is shown in the following table.
JMS, MQ or MQ JMS bindings | One-way operation in an interface | Request-response operation in an interface |
---|---|---|
Import binding | Client receives message | Client receives and sends message |
Export binding | Client sends message | Client sends and receives message |
To create an import with a messaging binding, open the assembly editor. From the import group on the palette, select an import and drag it on to the canvas. An import with no implementation and no interface is created. Right-click the import, select Add Interface from the context menu and add an interface with at least one operation. Generate the binding by right-clicking the import and from the context menu select Generate Binding > Messaging Binding > <JMS, MQ or MQ JMS Binding>.
To create an export with a messaging binding, open the assembly editor. From the component group on the palette, select an export and drag it on to the canvas. An export with no implementation and no interface is created. Right-click the export, select Add > Interface from the context menu and add an interface with at least one operation. Generate the binding by right-clicking the export and from the context menu select Generate Binding > Messaging Binding > <JMS, MQ or MQ JMS Binding>.
The service component architecture section discusses imports and exports and bindings.