Thursday, 13 February 2014

Windows Azure Biztalk Services : Context Based Routing


In context based routing, messages are routed to a single or multiple destinations based on the context of the message itself (Receive Location, Source Type). It is a core feature of most integration platforms and helps provide the framework for publish-subscribe architectures. When using context based routing, it is typically ideal to own dynamic subscriptions to permit terribly loosely coupled systems to be designed round the method

Business Scenario

Contoso (the supplier) receives Sales Order from multiple retailers .Contoso accepts orders for multiple brands of products they sell from many different partners in XML Format.Contoso partners can be sending order data via FTP.

Various partners can send XML messages to Contoso. Hence, Contoso has to implement a solution on Windows Azure, which enables the following:

  • Contoso must pull the XML messages at which partners drops the sales order messages from FTP. 
  •  Contoso must identify the partner and sends the Sales order to partners queue.

Step by Step

Create a Biztalk Service project - WABS.Blog.ContextBasedRouting

Configure MessageFlowIternary

Add FTP source and configure the FTP properties.

Folder Path , Mask , Username , Server Address , USE SSL.

Add another FTP Source and configure properties.

Add  Pass-through Bridge 

A Pass-Through Bridge is used when you want any message type to be processed by the bridge. As a result, a Pass-Through Bridge does not include validate or transform stages because both these stages are tied to message types. A Pass-Through Bridge only includes the Enrich stage, which is used for the same purposes as in an XML bridge. For more information on how to configure a Pass-Through Bridge, see Configuring a Pass-Through Bridge.

Configure enrich stage so that it write SourceName to message context .


Add two destination queues (XCompanyOrders , YCompanyOrders).

Configure XCompanyOrders queue properties

Set Runtime Address 

See How to configure Service Queue

Set Authentication properties (Copy Issuer Name , Issuer Secret from Azure portal).

Configure YCompanyOrders queue properties

Set Runtime Address, Set Authentication properties.

Connect passthroughbridge with XCompanyOrders Queue and set filters configuration .

Connect passthroughbridge with YCompanyOrders Queue and set filters configuration

Deploy the Solution. Provide Biztalk Service configuration to deploy the solution

Once the artifacts are deployed, they can be viewed and verified in BizTalk Services portal as shown below

Test The Solution

  1. Drop SalesOrderCompanyX.xml  into FTP Source Location  for CompanyX(free FTP hosting is available at
  2. PassThroughBridge  will pickup the data from FTP Source
  3. PassThroughBridge will enrich data (SourceName)
  4. Based on the route filter condition data will be routed to appropriate queue 
  5. Check on the portal that message is received in the corresponding Queue.

No comments:

Post a Comment