WebSphere Enterprise Service Bus, Version 6.2.0 Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows


Dynamic invocation with unwired JMS import

How to enable dynamic invocation of an endpoint with an unwired Java™ Message Service (JMS) data binding import. This information also applies to MQ JMS binding and Generic JMS binding.

Introduction

You can invoke services by using endpoints that are different to those specified in the import. For JMS bindings, a dynamic endpoint can be specified using a URI that conforms to the JMS URI standard.
Figure 1. Illustration of endpoint override by dynamic invocation, with unwired import
A message flows through a module and through the import binding to a Web service. Information in the message can override the endpoint dynamically.

You can create a mediation module that includes the dynamic endpoint, by performing tasks in WebSphere® Integration Developer.

Programmatic override of endpoint addresses

All the endpoints must use the same import binding configuration. The POJO identifies the required import in EPR, then uses SCA to wire to a compatible import.

You can use the SCA public API to override the endpoint address. In the following example code, the uri value must conform to the JMS URI standard.
epr = EndpointReferenceFactory.INSTANCE.createEndpointReference();
epr.setAddress(uri);
epr.setImport(importName);
Service dynamicService = (Service) ServiceManager.INSTANCE.getService(refname, epr);
The JMS URI has the same prefix as a WebServices SOAP/JMS endpoint address. Identify the correct endpoint type by adding a binding type attribute to the endpoint reference. If you do not specify the binding type attribute for the JMS URI, the address is interpreted as a SOAP / JMS endpoint, unless the endpoint reference is wired to a JMS import.

Representing the JMS endpoint

The JMS endpoint used in the dynamic invocation is structured according to the JMS URI standard.

In summary, the standard requires that JMS URIs have the form:
Read syntax diagramSkip visual syntax diagram
>>-scheme--:--jms-variant--:--jms-dest--?--parameter-----------><

scheme
The scheme for a JMS URI will always be jms.
jms-variant
The jms-variant provides more information about the JMS connection, for example by using the variant jndi.
jms-dest
This identifies the JMS destination object, and should correspond to the jms-variant.
parameter
Parameter is a key value pair separated by "=". The only key supported is "jndiConnectionFactoryName". The value of this key should be the jndi name of the connection factory. Usage of this parameter is optional.

Managing security

The JMS Connection Factory uses application managed security. It does not use container managed security. This means that you must set the component managed authentication alias.

An example of a valid JMS URI would be:

jms:jndi:MyTargetQueueName?jndiConnectionFactoryName=MyConnectionFactoryName

The input name for the send destination and the connection factory must already be defined in the server.

Creating a dynamic invocation with a JMS endpoint

To create a mediation module that includes the dynamic endpoint, perform the following tasks:
  1. Create Module 1, containing a POJO and an unwired Import.
  2. Create Module 2, containing Export 2 wiring to POJO 2.
  3. Create Module 3, containing Export 3 wiring to POJO 3.
  4. Check that the Import is configured to route messages to Export 2.
  5. Check that Export 2 and Export 3 have the same port type.
  6. Deploy the three modules to the server.

Using dynamic invocation

Dynamic invocation takes place when the POJO is invoked with the target import and Export 3 identified as the endpoint in the message. The POJO uses SCA EPR API to resolve the Import. The POJO extracts the endpoint from the message, and identifies Export 3 as the endpoint, rather than the Export 2 endpoint specified in the original Import. The POJO invokes the remote service specified by the endpoint in the message, through the target import specified in the message. After the service is invoked, a response is returned to the POJO.

A one-way invocation message works the same way as a two-way message, except that no response message is returned.

A runtime exception occurs when any one of three conditions is true:
  • The URI has invalid syntax.
  • The target import specified does not exist.
  • The endpoint specified does not exist.

reference Reference topic

Terms of use | Feedback


Timestamp icon Last updated: 21 June 2010


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.doc/ref/rwesb_dynamicroutingwithUnwiredJMSimport.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).