Tenalinaga's Blog

I am frog in a well. Every time I jump out of the well; I relialize I am in bigger well and eventually get bored which motivates me to get to next level.

ESB Static and Dynamic Resoultion and Itineraries

Itineraries” when I first heard this term it made no sense to my BizTalk brain. With in Short time I had to come Face to Face with ESB (Enterprise Service Bus) for one of my clients who want to implement SOA (Service Oriented Architecture) and also Error Handling using ESB Portal. There is lot of learning curve and it looked scary. I tried to propose alternatives to solve the problem due to short development time before us but pros clearly outweighed cons. That is when, I determined to make some progress with ESB and started to take a look at it and learn features of ESB.

This post explains the Messaging scenarios using
A) Dynamic Resolution for one way WCF service call
B) With Itineraries (UDDI Resolver) Dynamic Resolution for one way WCF service call
C) With Itineraries (BRE and Static Resolver) Dynamic Resolution for Two way WCF service call and Subsequent forwarding

Part 1: Creating WCF Services
Before entering into doing ESB features we first need to have some services up to route message to them. So I developed Orchestration A and Orchestration B.
Orch A has One Way receive Port has shown in fig below. Output is published to message box and there is a send port in the application that subscribes to this message type from Message box then routes it to output destination folder.

OneWayOrchestration

Orch B has Request response Port has show in fig below. This orchestration receives message and send response back.

TwoWayOrchestration

I published two orchestrations as WCF services (OrchA is a one way receive port and OrchB is Two-way req-resp receive port) and allowed WCF service to create Receive ports in my BizTalk application named SNR.Mamata.CommonArtifacts. Associated orchestration bindings to these receive ports.
So Here we have created 2 WCF Services one is one way other is req-resp. So we will use these services to develop Messaging scenarios using ESB core features.

Part-2 : ESB Implementation

A) Dynamic Resolution for one way WCF service call
I have created a new BizTalk Application SNR.Mamata.DynamicResoultion. Here I am trying to implement a messaging scenario to call one way WCF service. I want to pick up a .xml file from Receive Location in File System.

Custom Pipeline has just one ESB pipeline component “ESBDispatcher”. This component figures out the end point configuration using BRE, Static, UDDI …

Here I used BRE to configure endpoint information by calling a policy.

BRE policy is shown below. condition 1 equals 1 always evaluates to true so end point transport type, target namespace, WCF action, outbound transport location is set. you could also have BRE by evaluating any context properties.

Now I created a create a Dynamic send port that subscribes to this message by receive port name (BTS.ReceivePortName). For now do not worry about other Filter expressions(Not related to this scenarioA). Those are used later and will be explained in the below part.

What did we Just do:
When message is received from Receive port Custom Pipeline with ESB dispatcher calls BRE and gets the outbound end point configuration details. The send port subscribes to these messages and send this message to the transport location using protocol specified.
This need not always be BRE, it can be UDDI or Even Static
Static resolver looks like
STATIC:\\TransportType=WCF-WSHttp;TransportLocation=WCF-WSHttp://http://ComputerName/Naga_BizTalk_WcfSchemaService/Naga_BizTalk_WcfSchemaService
STATIC:\\TransportType=FILE;TransportLocation=FILE://C:\Projects\Microsoft.Practices.ESB\ESBSource\Source\Samples\DynamicResolution\Test\Filedrop\OUt\%MessageID%.xml;Action=;EndpointConfig=;JaxRpcResponse=false;MessageExchangePattern=;TargetNamespace=;TransformType=;
BRE:\\policy=Example;version=;useMsg=;

B) With Itineraries (UDDI Resolver) Dynamic Resolution for one way WCF service call
Here we will do the same with help of Itinerary. In the Dynamic send port add the remaining filter expressions (Hold on I Shall explain what they are below)
We also create a new receive port and location to pick up .xml message from File location. We now use ESB Itinerary selector pipeline component which is available in “Itineraryselectreceivexml pipeline” or your own custom pipeline.

Itinerary Key fact Resolver.Itinerary indicates thats Itinerary is avilable from SQL server Database with name UDDIItinerary.

To develop UDDIItinerary first create a C# class library then create a new itinerary. Drag on Ramp and off ramps. and two Itinerary services. There should be off-ramp extender before OffRamp.

OnRamp: select the Extender and BizTalk application and Receive Port Name.

ItineraryService1: select the container and Itinerary service name (Routing/Transformation) Routing in our case.
Resolver: Add new Resolver and select UDDI resolver component.
Within the First Itinerary service we have add new resolver and select UDDI in resolver implementation. It be any one of the available. Binding key can be used to resolve the end point information.

Off Ramp: Select the dynamic send port that promotes your filter expression values to the message context properties so your dynamic send port can subscribe the message.

c) With Itineraries (BRE and Static Resolver) Dynamic Resolution for Two way WCF service call and Subsequent forwarding
In this example we extend the same above Itinerary. We create pick up the .xml from the file location and call the request-response web service then route the message to other dynamic send port that drop the message to the file location.

I have used BRE for path resolution. Choosing BRE resolver implementation would let you select the BRE policy and version.

Below is the ploicy created using BRE.

We also used static resolver to route the response from WCF service to the file location.

We need to create two dynamic ports. one is Req-Resp port to make a call to 2-way WCF Service. It uses ItinerarysendPassThrough Pipeline which has ESB Itinerary Cache and preserves the state of the itinerary. Upon the response from WCF service Itinerary again starts getting executed from that point.
with filter expersions as below
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == DynamicReqResp And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging And
Microsoft.Practices.ESB.Itinerary.Schemas.IsRequestResponse == True

Upon receiving response ItineraryFrowarderSendReceive Pipeline Component evaluates static resolver and contiunethe itinerary. It has filter expersion as below
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == DynamicCacheSendService And Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging And
Microsoft.Practices.ESB.Itinerary.Schemas.IsRequestResponse == False

ESB Dynamic Gudiance inside orchestration is avilable in the lnk

http://www.go4answers.com/Example/dynamic-itinerary-orchestration-48755.aspx

http://talentedmonkeys.wordpress.com/2010/04/24/resolving-a-dynamic-send-port-in-a-biztalk-orchestration-using-esb-toolkit-2-0/

Advertisements

One response to “ESB Static and Dynamic Resoultion and Itineraries

  1. Sandeep December 15, 2010 at 5:21 am

    Awesome Nag! way to go!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: