About Me

About Me
Working with SOA technologies , implementing solution using IBM BPM , IBM Integration Designer,IBM WODM and IBM DataPower

About me

View Mahesh Dondeti's profile on LinkedIn

upcoming posts on IBM Bluemix,Devops,Worklight,Node js.

Monday, 17 December 2012

Dynamic invocation in WESB:-

WebSphere® ESB supports re-routing of messages, by dynamic override of statically-defined endpoints or dynamic invocation using a target import.
When a mediation module is developed and deployed, the flow of messages through the module uses static information. You can enter fixed values describing the imports, bindings and targets using WebSphere Integration Developer. Messages passing through the mediation module use these values.
For some applications, you can override or change some of these static values at runtime. You might do this dynamically by overriding a value specified for an endpoint address. Alternatively, you can select a new target import. In each case, the message flow changes according to the information in the message. For example, you can use WebSphere Integration Developer to create bindings that contain endpoint information specifying the location of a remote service. This static endpoint information can be overridden dynamically by information carried in the message. The dynamic information might specify a different endpoint for the message. You can access the endpoint using one of several supported bindings, including Web service, HTTP, Java™ Message Service (JMS), and WebSphere MQ.
Rerouting a message dynamically allows you to:

  • Route the message to a local endpoint within a mediation module.
  • Route the message to a remote endpoint, through a wired reference.
  • Route the message to a remote endpoint, through an unwired reference.
  • Route the message to a remote endpoint, through a named import within the mediation module.


To know the concept of dynamic invocation I took the simple scenario.This scenario aims take Customer details from source system in XML format send those customer details to External System(WMQ,Webservice,FTP,......).Based on customer country we need to send the customer details to particular Queue.

For example:

If the country is USA then send details to LQ2 in QMG2.

If the country is IND then send details to LQ3 in QMG3.

otherwise  send details to LQ1 in QMGR3.

Simply we are choosing the target queue/Queue Manager based on the input(Customer Country).

To achieve the above scenario I followed the below steps.

First Create the Module with name (MP_Dynamicinvoke_MQ).

Business Object:-(Customer)

  1. First create the simple BO with following fields as shown in below figure


2)Then create the simple interface with one way operation 


Here is simple Assembly Diagram:-


Here I took the import component and Added the interface which we created earlier.Configured as shown below.

Dynamic invocation with wired MQ import

If you observe the below mediation flow . There no service invoke /call-out primitives but we can call the external system using simple java code in custom mediation.


DataObject customerBO=smo.getDataObject("body").getDataObject("getCustomer").getDataObject("input").getDataObject("customer");

java.lang.String ccountry = smo.getDataObject("body").getDataObject("getCustomer").getDataObject("input").getString("ccountry");

String uri=null;

if (ccountry.equals("USA"))


else if(ccountry.equals("IND"))




EndpointReference epr =EndpointReferenceFactory.INSTANCE.createEndpointReference();



Service dynamicService = (Service)ServiceManager.INSTANCE.getService("IF_CustomerPartner", epr);


Add the following imports to the  java imports section  in properties tab of custom mediation primitive:-
import com.ibm.websphere.sca.*;
import com.ibm.websphere.sca.addressing.EndpointReference;
import com.ibm.websphere.sca.addressing.EndpointReferenceFactory;
import commonj.sdo.DataObject;

Dynamic invocation with out wired MQ import:-

we have to set the import name which you want call . setImport(“importname”) like that we can set the port values also setPorttype(“”),setPort();

Assembly diagram as follows:

In the Same way we can also call the External systems(EIS),webservies,HTTP

Each external system having the uri format so we need to follow that format

In the Adapter case we need to use the below uri format:-


The scheme for JCA URI is always jca.
The jca-variant provides more information about the JCA connection, and is always jndi.
This identifies the JCA Connection Factory providing the dynamic target address for a message.
An example of a valid JCA URI would be:
This URI tells the EIS Import handler to look for a Connection Factory defined in JNDI as dynamicTestJNDI.

Test the scenario by giving the different country names(USA,IND,.....).And Observe the output in the Queues.

No comments:

Post a Comment