locked
correlation RRS feed

  • Question

  • what is the difference between correlation and singleton orchestration?

    Both will do same kind of activity like one 1 instance will create for all messages.

    plz explain?

     
    Friday, May 20, 2016 7:33 AM

Answers

  • Hello,

    Singleton orchestration is designed using correlation.

    BizTalk server detects the potential for certain race conditions, which are ensured that all correlated messages are received by the same orchestration instance. The potentiality of these race conditions is detected by BizTalk server. These messages are treated as a ‘convoy’. A convoy set is a group of correlation sets. All such subsequent messages which match the general subscription are evaluated against the convoy set, and the matched convoys are routed to an existing port.

    The singleton pattern is implemented by creating a service ,the first instance gets created when the first message arrives in BizTalk MessageBox, After that other message( which have something common, like received from same source or anything which groups them to be processed by one single instance of the service) gets processed with the same instance which was previously created.

    The common way for creating a singleton orchestration is , Source is from this blog post 

    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).
    Below are few more references for you on this .

    BizTalk – How does one create a Singleton Orchestration?

    BizTalk Singleton Orchestration Design

    Sequential Convoys / Singleton Orchestration In BizTalk Demo

    Sequential convoy using listen shape in BizTalk

    To learn more about convoys:

    Working with Convoy Scenarios

    Convoy in biztalk orchestration


    Rachit Sikroria (Microsoft Azure MVP)


    Friday, May 20, 2016 8:13 AM
    Moderator

All replies

  • Hello,

    Singleton orchestration is designed using correlation.

    BizTalk server detects the potential for certain race conditions, which are ensured that all correlated messages are received by the same orchestration instance. The potentiality of these race conditions is detected by BizTalk server. These messages are treated as a ‘convoy’. A convoy set is a group of correlation sets. All such subsequent messages which match the general subscription are evaluated against the convoy set, and the matched convoys are routed to an existing port.

    The singleton pattern is implemented by creating a service ,the first instance gets created when the first message arrives in BizTalk MessageBox, After that other message( which have something common, like received from same source or anything which groups them to be processed by one single instance of the service) gets processed with the same instance which was previously created.

    The common way for creating a singleton orchestration is , Source is from this blog post 

    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).
    Below are few more references for you on this .

    BizTalk – How does one create a Singleton Orchestration?

    BizTalk Singleton Orchestration Design

    Sequential Convoys / Singleton Orchestration In BizTalk Demo

    Sequential convoy using listen shape in BizTalk

    To learn more about convoys:

    Working with Convoy Scenarios

    Convoy in biztalk orchestration


    Rachit Sikroria (Microsoft Azure MVP)


    Friday, May 20, 2016 8:13 AM
    Moderator
  • To add, correlation is a BizTalk feature that enables patterns like singleton. In general terms, correlation is a way to route back a message from the MessageBox to an already existing instance.

    Imagine there is a scenario where BizTalk is receiving an Order message over FILE adapter. There is an orchestration that receives this Order and sends it to a second folder for Order approval. Now, this orchestration waits until the approved message is available in a third folder. The way you would make your orchestration 'wait' until the approval message appears in the third folder is via Correlation. You can initialize a CorrelationSet over OrderId property(for example) in the orchestration Send Shape to the second(approval) folder. The orch Receive Shape that is tied to the third folder would be following the same correlationset - whenever an approved message with the same OrderId appears in the 3rd folder, it would be routed back to this same orchestration instance.

    So in short correlation is a more generic concept that can enable more patterns - singleton is just one such pattern(where a only a single orchestration instance should process a set of all related messages).

    Refer this for a sample on correlation-

    http://social.technet.microsoft.com/wiki/contents/articles/13729.walkthrough-correlations-in-biztalk-orchestration.aspx


    Thanks Arindam










    Friday, May 20, 2016 8:33 AM
    Moderator