You can configure the Service Component Architecture (SCA) Java Message Service (JMS) binding for services and references to support messaging between SCA applications and JMS providers.
Use the administrative console to enable the SIB service and Configuration reload enabled option on the application server where the application runs. Restart the server to enable the dynamic reloading of the SIB configuration files for this server. See the SIB service settings information to learn more about enabling the SIB service.
When you use the JMS binding, it is important that you follow best practice guidelines on design, configuration, and tuning of the messaging topology. Following these guidelines is especially important when you design systems for high throughput or high availability. Read the documentation on using JMS bindings in this information center, specifically "Multiple-server bus with clustering." The developerWorks articles "Configuring and tuning WebSphere MQ for performance on Windows and UNIX" and "Performance tuning for Java Messaging Service on WebSphere® Application Server on z/OS" also provide useful information.
Bindings determine how a component communicates with the world outside its domain. SCA services use bindings to describe the access mechanism that clients must use to call the service. SCA references use bindings to describe the access mechanism used to call a service.
Using the SCA JMS binding, you can make SCA components available over JMS or you can use existing JMS applications within an SCA environment. You can use the SCA JMS binding element, <binding.jms>, within either a component service or a component reference definition. When a JMS binding is applied within a component service interface definition, the JMS binding enables clients to access an SCA service that is offered by a JMS provider. When the JMS binding is applied on a component reference, the SCA component can consume an external JMS application or another SCA component using JMS.
WebSphere Application Server supports asynchronous messaging using JMS. The default messaging provider enables enterprise applications deployed on WebSphere Application Server to perform asynchronous messaging without the need for you to install a JMS provider. The default messaging provider is installed and runs as part of WebSphere Application Server. The product supports the default messaging provider or WebSphere MQ as the messaging engine.
The SCA JMS Binding specification describes the <binding.jms> binding element and available attributes and options. To learn more about the <binding.jms> binding element, see the SCA JMS Binding specification documentation.
This task describes the steps necessary to enable SCA applications for JMS using request-response or one-way messaging.
You have defined the JMS resources you need for your SCA application, configured the SCA JMS binding for your SCA services and references, and deployed your application. Your application is now ready for use.
The following example illustrates two SCA component implementations and the use of request-response and one-way messaging.
The HelloService component implementation illustrates the request-response message pattern. This HelloService component exposes the service interface with the name, getGreeting, that is used to illustrate a return response of hello plus the value of getGreeting.
The LoggingService component implementation is a logging service. This component exposes a one-way service interface with the name, log, that receives a message and logs the message in a repository.
The HelloService has an SCA reference to the LoggingService. Each time the HelloService service receives a message, it calls the LoggingService service to log the message.
In this example, a Thin Client for JMS application sends a message, formatted as a JMS ObjectMessage message type to the SCA HelloService using the jms/SCA_sample_Request queue. The ObjectMessage sets the scaOperationName property to the value, getGreetings. The HelloServiceComponent receives the message over the JMS HelloService binding. The HelloServiceComponent then sends a request to the referenced service, LoggingService, and the one-way operation is complete. HelloServiceComponent sends a response of hello plus the value of getGreetings to the client application using the jms/SCA_sample_Response queue to complete the request-response operation.
Configuring an SCA JMS binding for a request-response service from a JMS client to SCA service
The following example describes a <binding.jms> element within the component definition file for a request-response message exchange pattern from a JMS client to an SCA service:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.ibm.com/soa/sca/samples" xmlns:hw="http://www.ibm.com/soa/sca/samples" xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0" name="HelloServiceComposite"> <component name="HelloServiceComponent"> <implementation.java class="soa.sca.samples.jms.HelloServiceImpl"/> <service name="HelloService"> <interface.java interface="soa.sca.samples.jms.HelloService"/> <binding.jms> <destination name="jms/SCA_sample_Request" type="queue"/> <activationSpec name="jms/SCA_sample_AS"/> <response> <destination name="jms/SCA_sample_Response" type="queue"/> <connectionFactory name="jms/SCA_sample_CF"/> </response> <ts:wireFormat.jmsObject/> </binding.jms> </service> </component> </composite>
The following example describes a <binding.jms> element within the component definition file for a one-way interaction from one SCA service to another SCA service. The <binding.jms> binding definition is similar to the HelloService; however, because the message operation is one-way, there is not a response definition.
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.ibm.com/soa/sca/samples" xmlns:hw="http://www.ibm.com/soa/sca/samples" xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0" name="HelloServiceComposite"> <component name="LoggingService"> <implementation.java class="soa.sca.samples.jms.LoggingServiceImpl"/> <service name="LoggingService"> <interface.java interface="soa.sca.samples.jms.LoggingService"/> <binding.jms> <destination name="jms/SCA_Logging_Request" type="queue"/> <activationSpec name="jms/SCA_sample_AS"/> <ts:wireFormat.jmsObject/> </binding.jms> </service> </component> </composite>
Configuring an SCA JMS binding for two-way service from a JMS client to SCA reference
The following example describes a <binding.jms> element within the component definition file for a request-response message exchange pattern from a JMS client to an SCA reference:
SCA reference
<reference name="helloWorldService"> <interface.java interface="my.HelloWorldService"/> <binding.jms> <connectionFactory name="jms/helloWorldServiceCF"/> <destination name="jms/HelloWorldService"/> <response> <destination name="jms/SCA_sample_Response"/> </response> </binding.jms> </reference>
Based on your business needs, you can configure an SCA JMS binding wire format or configure transactions for the SCA JMS binding.
After you obtain your SCA components, deploy the components in an application and test the JMS binding.
In this information ...Subtopics
Related concepts
Related tasks
Related reference
| IBM Redbooks, demos, education, and more(Index) |