none
Parent-Child Correlation in BizTalk

    Question

  • Hello, I have a requirement where I will be receiving the sets of messages with correlation explained as below. 

    I am trying to figure out right way to define a correlation where I can process the Parent message and its corresponding child messages in one Instance of an Orchestration.

    I am thinking I should use a parallel convoy, am I right?

    Please let me know, how can I go about this.. 

    TIA :)

    
    Monday, February 13, 2017 6:34 AM

Answers

  • It may not be a perfect solution but I would like to give my opinion here. :-)

    • I would avoid convoys in this case  due to various reasons. 
    • I will create a temporary database and two tables
    • As soon as I receive a Parent I will store it in the database. I can count how many child messages will come (based on counting Child ID)
    • As soon as a child comes i will store it while inserting a child i can go back and query the parent table to see if parent has this child ID, if there is one I will create the relation , this is not actually important here but just in case.
    • Will write a stored procedure which will query the database and return one xml (with a Parent and all its child). we can decide if all child are there based on a count in the child node in the parent.
    • Return this one composite xml to BizTalk
    • a SQL receive location will keep on polling this Stored procedure , as soon as a new complete xml document is available , it will pick and submit to mesagebox 
    • One BizTalk orchestartion will pick this up and process it. 

    I checked above notes , it seems you are using http receive location so In this case

    I really hope it helps you. Just wanted to share my thoughts. 

    All the best. Please feel free to post your solution whatever you plan to do. 


    Cheers,HTH

    Naushad Alam http://alamnaushad.wordpress.com/

    When you see answers and helpful posts, please click Vote As Helpful , Propose As Answer , and/or Mark As Answer

    Tuesday, February 14, 2017 7:29 PM
    Moderator
  • Its quite unusual as John mentioned, Anyways, try implementing something like this

    Following are the steps for implementing orchestration:
    1. Add first receive shape for receiving parent message {do not initiate correlation here}
    2. Include a loop for each childId in parent message
    3. Add a scope shape (define correlationSet within this scope)
    4. Add ConstructMessage shape and Set the contextProperty(custom/ResouceId) used for correlation 
    4. Add send shape to initialize correlationSet (within the scope created above) send parent/temp/dummy message here.
    5. Add receive shape to receive child message and follow correlationSet here  (within the scope created above)
    6. Exit scope
    7. Increment Counter
    8. Exit loop

    Note:
    1. Define ContextProperty of type MessageContextPropertyBase 
    2. Promote ResourceId of childMessage for the context property defined above
    3. Define correlationSet within the scope

    I created a sample to show how the orchestration will look like but technet is not allowing me to post image, as I new to this. 
    ------------------------------------------------------------------
    If my post help? "Mark as answer" or "Propose as answer". Thanks

    


    • Edited by NarendraSharma Wednesday, February 15, 2017 7:26 AM spell check
    • Proposed as answer by SMSVikasKEditor Wednesday, February 22, 2017 1:58 AM
    • Marked as answer by SMSVikasKEditor Wednesday, February 22, 2017 1:58 AM
    Wednesday, February 15, 2017 7:20 AM

All replies

  • Yes. A Convoy using Correlation Sets would be the way to go.

    Do you know if you'll always receive the Parent first, and then the children (Ordered Delivery)?


    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!


    Monday, February 13, 2017 7:34 AM
  • Hello Leo,

    Yes, we will get Parent first but there is not much time lag between parent and child. Probably few milliseconds. 

    Monday, February 13, 2017 7:35 AM
  • Hello Leo,Could you please share few details? I am at a loss as how to implement the Correlation set in my scenario. 
    Monday, February 13, 2017 10:34 AM
  • Well, no.  A Parallel Convoy will not work unless you know exactly how many will come in every group.

    You will need to use a Sequential Convoy. However...

    The problem with this scenario is there is no one ID that is shared by all the entities.  It's using a highly unusual 'reverse join' where the Parent point to the Child.

    Couple questions:

    How do these come in?  What Transport?

    Is there anything in the Child entities that points to the Parent?  Resource ID = 123.  Can they change the output do to that?

    Monday, February 13, 2017 12:58 PM
    Moderator
  • Hello Leo,

    Hope below comments resolve your question :-

    How do these come in? >> Over HTTP receive Location

    What Transport? >> XML with custom pipeline to promote properties.

    Is there anything in the Child entities that points to the Parent?  Resource ID = 123.  >> No

    Can they change the output do to that? >> I suppose I can have a canonical schema to achieve this.

    Monday, February 13, 2017 4:16 PM
  • Hello Leo,

    Can they change the output do to that? >> I suppose I can have a canonical schema to achieve this.

    Leo?

    A Canonical Schema would not help.  The source really should change their output so that Child Resources point to the Parent Resource.  That's the 'correct' way to do it.

    Monday, February 13, 2017 6:02 PM
    Moderator
  • Hello Johns, I am sorry. I assumed that Leo had replied. :(

    So, Correlation can not be achieved that easily. There is no option of having source schema changed. :(

    Tuesday, February 14, 2017 4:01 AM
  • The problem is not the Schema or structure, it's the data.  That's not a problem with you or BizTalk.

    By having the Parent point to the children, which is highly unusual, the source is creating this problem so they need to fix it.

    Tuesday, February 14, 2017 12:21 PM
    Moderator
  • It may not be a perfect solution but I would like to give my opinion here. :-)

    • I would avoid convoys in this case  due to various reasons. 
    • I will create a temporary database and two tables
    • As soon as I receive a Parent I will store it in the database. I can count how many child messages will come (based on counting Child ID)
    • As soon as a child comes i will store it while inserting a child i can go back and query the parent table to see if parent has this child ID, if there is one I will create the relation , this is not actually important here but just in case.
    • Will write a stored procedure which will query the database and return one xml (with a Parent and all its child). we can decide if all child are there based on a count in the child node in the parent.
    • Return this one composite xml to BizTalk
    • a SQL receive location will keep on polling this Stored procedure , as soon as a new complete xml document is available , it will pick and submit to mesagebox 
    • One BizTalk orchestartion will pick this up and process it. 

    I checked above notes , it seems you are using http receive location so In this case

    I really hope it helps you. Just wanted to share my thoughts. 

    All the best. Please feel free to post your solution whatever you plan to do. 


    Cheers,HTH

    Naushad Alam http://alamnaushad.wordpress.com/

    When you see answers and helpful posts, please click Vote As Helpful , Propose As Answer , and/or Mark As Answer

    Tuesday, February 14, 2017 7:29 PM
    Moderator
  • Its quite unusual as John mentioned, Anyways, try implementing something like this

    Following are the steps for implementing orchestration:
    1. Add first receive shape for receiving parent message {do not initiate correlation here}
    2. Include a loop for each childId in parent message
    3. Add a scope shape (define correlationSet within this scope)
    4. Add ConstructMessage shape and Set the contextProperty(custom/ResouceId) used for correlation 
    4. Add send shape to initialize correlationSet (within the scope created above) send parent/temp/dummy message here.
    5. Add receive shape to receive child message and follow correlationSet here  (within the scope created above)
    6. Exit scope
    7. Increment Counter
    8. Exit loop

    Note:
    1. Define ContextProperty of type MessageContextPropertyBase 
    2. Promote ResourceId of childMessage for the context property defined above
    3. Define correlationSet within the scope

    I created a sample to show how the orchestration will look like but technet is not allowing me to post image, as I new to this. 
    ------------------------------------------------------------------
    If my post help? "Mark as answer" or "Propose as answer". Thanks

    


    • Edited by NarendraSharma Wednesday, February 15, 2017 7:26 AM spell check
    • Proposed as answer by SMSVikasKEditor Wednesday, February 22, 2017 1:58 AM
    • Marked as answer by SMSVikasKEditor Wednesday, February 22, 2017 1:58 AM
    Wednesday, February 15, 2017 7:20 AM
  • Although it would be nice to implement this internally in BizTalk, the solution from Alam really is an interesting approach. In the long run, it's probably also the easier one.

    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Wednesday, February 15, 2017 7:43 AM