Tuesday, May 10, 2011

BizTalk – How does one create a Singleton Orchestration?

1.    Create a correlation type with the property “BTS.ReceivePortName;” this will ensure a single instance of an orchestration, since all the messages come from a single receive location.

2.    Create a correlation set with the correlation type created in the previous step.

3.    In the first Receive Shape (Activate = true), set the property “Initializing Correlation Sets” as the correlation set (created in the previous step) and in the Second receive shape (Activate = false), set the property “Following Correlation Sets” as the correlation type (created in the previous step).

NOTE: Any promoted property which would be the same across all the messages can also be used as the correlation type property.

The first message that arrives at the Receive port creates a new instance of the Orchestration. All other messages would use the same Orchestration for processing.

A BizTalk Correlation would ensure that the messages which arrive into the Orchestration have at least one similar property.  For example, the messages arrive from the same Receive Port or they have the same InstanceID or flag property. For a single Orchestration to exist, all the messages which arrive at the orchestration must have one common property. This common property of the messages must be encapsulated into a Correlation set.

The Correlation set created above shall be initialized on the receipt of the first message which creates the Singleton Orchestration, all other subsequent messages would use the same Correlation set and, therefore, the same Orchestration instance.

No comments:

Post a Comment