Introduction

This Article gives an overview of how to do Content-Based Routing on Azure BizTalk services

In Content-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 Orders 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 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 a 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 DriveHq.com).
  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.

See Also

Another important place to find a huge amount of Azure BizTalk Services related articles is the TechNet Wiki itself. The best entry point is Azure BizTalk Services resources on the TechNet Wiki.

If you are also looking for BizTalk Server related articles, the best entry point is BizTalk Server Resources on the TechNet Wiki.