WebSphere Enterprise Service Bus for z/OS, Version 6.2.0 Operating Systems: z/OS


Dynamic invocation with wired MQ import

How to enable dynamic invocation of an endpoint with a wired MQ data binding import.

Introduction

You can invoke services by using endpoints that are different to those specified in the import. For MQ bindings, you can specify a dynamic endpoint by using a URL that conforms to an MQ URI standard.
Figure 1. Illustration of endpoint override by dynamic invocation, with wired import
Illustration of endpoint override by dynamic invocation, with a wired import. A message flows through a mediation module and passes through the import binding to a Web service. Information in the message can be used to override the endpoint dynamically so that the message is sent to another Web service.

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

Programmatic override of endpoint addresses

You can use the SCA public API to override the endpoint address. In the following example code, the uri value must conform to the MQ URI standard.
epr = EndpointReferenceFactory.INSTANCE.createEndpointReference();
epr.setAddress(uri);
Service dynamicService = (Service) ServiceManager.INSTANCE.getService(refname, epr);

Representing the MQ endpoint

The MQ endpoint used in the dynamic invocation is structured using a subset of the MQ URI standard.

For dynamic invocation, the MQ endpoint must have a URI with the form:
Read syntax diagramSkip visual syntax diagram
>>-wmq:/msg/queue/--queueName--+-------+-----------------------><
                               '-@qmgr-'   

In each URI, the queueName and optional destination queue manager qmgr override the destination queue specified on the import binding.
Examples of a valid MQ URIs are:
wmq:/msg/queue/queueName 
wmq:/msg/queue/queueName@qmgr 

Creating a dynamic invocation with an MQ endpoint

To create a mediation module that includes the dynamic endpoint, perform the following tasks:
  1. Create Module 1, containing a POJO wiring to Import.
  2. Create Module 2, containing Export 2 wiring to POJO 2.
  3. Create Module 3, containing Export 3 wiring to POJO 3.
  4. Configure the Import 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 Export 3 identified as the endpoint in the message. 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 deployment. The POJO uses the SCA EPR API, and the reference wired to the Import, to invoke the remote service specified by the endpoint 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.

If the POJO is invoked with an empty or missing argument for the endpoint, the default invocation is used, calling Export 2 and POJO 2.

A runtime exception occurs when any one of two conditions is true:
  • The URI has invalid syntax.
  • 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.zseries.doc/ref/rwesb_dynamicroutingwithwiredMQimport.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).