Sample: Using EAI Bridges to Send/Receive Messages from Service Bus Relay Services

I have a new sample to share. This sample demonstrates how to send messages of different XML schemas to a request-reply EAI Bridge deployed on Windows Azure Service Bus. The bridge runs some processing logic, which is configured using the different stages of the bridge (Validate, Enrich, and Transform). The bridge then sends the message to a two-way relay service deployed on the Service Bus. The response from the bridge is sent back to the bridge, which processes it again, and then sends it back to the client that sent the original message.

The sample is posted at https://code.msdn.microsoft.com/Using-EAI-Bridges-to-Send-38e464df

Scenario Used in the Sample

Northwind Traders is an automobile insurance company. Northwind Traders gets request for new policy quotes in an XML format compliant with the standard ACORD schema, an industry standard for insurance messages. The incoming messages can be in any format specified by ACORD so Northwind Traders has to configure a solution that can process XML messages conforming to more than one XML schema. After the message is received by Northwind Traders, it is validated against the ACORD message schema, transformed into a schema required by Northwind, and then sent to a backend service that processes the message further. However, there are certain routing conditions before the message is sent to the service.

  • If the quote amount in the message is less than $10000, it must be sent to one relay service, say RelayServiceA. Before sending the message to the service, a SOAP header called QuoteType must be added to the message header and the value of the header must be set to SmallAmounts.
  • If the quote amount in the message is greater than $10000, it must be sent to another relay service, say RelayServiceB. Before sending the message to the service, a SOAP header called QuoteType must be added to the message header and the value of the header must be set to LargeAmounts.

After receiving the message the services generate a response, add headers, and send a response back to the bridge. The services add the following headers:

  • If the response is received from RelayServiceA:
    • Header MsgStatus is added and the value is set to Success
    • Header Eligibility is added and the value is set to ApprovedForSmallAmounts
  • If the response is received from RelayServiceB:
    • Header MsgStatus is added and the value is set to Success
    • Header Eligibility is added and the value is set to ApprovedForLargeAmounts

The response from the service is in the same format as the Northwind’s internal request format. After the bridge receives the response, it transforms it to the response message schema compliant with ACORD standards. The bridge also extracts the value from the MsgStatus header and assigns it to an element in the response schema. Finally, before sending the message back to the client, the bridge adds another header called ProcessingStatus and sets its value to Complete. The following illustration represents this scenario.

Capture

Links

A tutorial on how to build this sample from ground up is available at https://msdn.microsoft.com/en-us/library/windowsazure/jj158971.