Advanced correlation

Filed under BPI
Tagged as

For a client I described an architecture where a validation process should be used for several parties. I want to make a generic process, because all the processes look the same, with only some differences on transport, ack/nack after validation, schemas and mappings. The main processes would be: Validation and Processing, where Validation will do the validation on the message (against schema, party resolution, duplicate check) and Processing will do the mapping (and validation) and sending the message to the receiving system. This all will be configurable. Because I want to use a generic process and the client has to deal with One-Way and Two-Way receive ports, I had to figure something out for myself and the developers: how can the Validating and Processing process (orchestrations) stay generic, without copying it to a new Orchestration with the same functionality? The answer to this is: use a helper Orchestration for Request-Response support and correlation for routing messages to the Orchestrations and back to the MessageBox. The demo contains a basic helper Orchestration for the Request-Response mechanism and an Orchestration which does some validation. This Validation Orchestration is very basic and only for showing how to use Correlation and send back to the calling Orchestration.

Next steps take place:

  • Receive message from any transport and use a custom pipeline component for promoting some context properties for routing to the right process (adding a routing slip).
  • Depending on the promoted property the next Orchestration will be started:
    • ReqRespOrch – Helping Orchestration for Request-Response pattern
      • Promote context property with value of Validating Process
      • Send message back to the MessageBox with initializing a correlation set
      • Wait for a while for a response (listen) with the same correlation token (because I used XmlDocument in the whole process, I had to create a specific response else the Orchestration would trigger itself straight away. This response can hold for example another Xml. Not detailed here).
      • Send the response back
    • ValidateMessage – Orchestration for validating a message. Can be started by ResRespOrch (properties set over there) or by the OneWay port (properties set over there)
      • Use XmlValidator for validating a message. In this demo I hardcoded the schema to validate against.
      • Promote the right context properties. Depending on the kind of Receive Port (OneWay or TwoWay), the BTS.Operation is copied from the incoming message to the outgoing message (Ack in this demo). Also promote the correlation token from the incoming message and update the routing property.
      • Send Message back to MessageBox
  • Depending on the context properties (and with that: correlation) the message will be send back to ReqRespOrch or to a send port which has the right subscription on the context properties.

Techniques used in this Demo:

  • Promoting custom context properties in a custom pipeline component
  • Using correlation for returning the process back to the Orchestration
  • Promote context properties within an Orchestration (use initializing correlation set on send port, you don’t have to follow this correlation set)
  • Use generic documents (XmlDocument)
  • Use filtering for routing messages through your BizTalk environment
  • Use XmlValidator for validating messages in an Orchestration, so you have full control on the outcome of that
  • Use BizTalk Deployment Framework and BizTalk Software Factory (http://bsf.codeplex.com)

This demo is very basal, but has all ingredients for a generic solution. The only thing not used here is use of configuration in Single Sign-On. I also didn’t put effort in the WebService, so this receives an ‘any’ message. And of course because this is a demo I didn’t use standards and naming conventions.

Note: because the client is using BizTalk Server 2006 (not R2) I had some limitations for myself. This solution will also working in newer versions for BizTalk Server.

You can download the demo here. Feel free to use or copy what ever you need. If you have any questions or remarks then don’t hesitate to contact me. Also when you think the above solution could work in a different way. And yes: you don’t get any warranty ;-)

Cheers…

  • Share/Bookmark

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*