locked
BAM data not moving to _Completed table RRS feed

  • Question

  • We have implemented BAM tracking for the following scenario

    A message comes to BizTalk, and BizTalk sends this to external service asynchronously.

     - This message has multiple records and each record has an ID. We call a .Net component (method1) to track each record to BAM using OrchestrationEventStream.

    External service sends back response to BizTalk later.

     - Response message contains response for all the records in the request message. Now we use continuation and update BAM data by calling method2 from .Net component. This method also calls 'end activity'.

    However we see that BAM data is saved in _Active table and NOT moved to _Completed table.

    (We are calling the .Net from BRE)

    Method1(TypedXmlDocument msgRequest)

    For each record

    OrchestrationEventStream.BeginActivity(ActivityName, ActivityId);

    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data1", data);

    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data2", data);

    Method2(TypedXmlDocument msgResponse)

    For each record

    OrchestrationEventStream.EnableContinuation(ActivityName, ActivityId, token);

    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data11", data);

    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data22", data);

    OrchestrationEventStream.EndActivity(ActivityName, ActivityId);




    • Edited by btsdotnet Thursday, November 26, 2015 10:36 AM
    Thursday, November 26, 2015 10:32 AM

Answers

  • Method 1 should end with enabling continuation and then end activity. In Method 2 you will not begin but use the continuation token as activity id and when done use End Activity. Only then will the data be moved to completed table. Till the continuation is closed, the activity is considered active.

    So IMHO the activities should look like

    Method 1:

    OrchestrationEventStream.BeginActivity(ActivityName, ActivityId);
    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data1", data);
    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data2", data);
    OrchestrationEventStream.EnableContinuation(ActivityName, ActivityId, token);
    OrchestrationEventStream.EndActivity(ActivityName, ActivityId);
    

    and Method 2:

    OrchestrationEventStream.UpdateActivity(ActivityName, token, "Data11", data);
    OrchestrationEventStream.UpdateActivity(ActivityName, token, "Data22", data);
    OrchestrationEventStream.EndActivity(ActivityName, token);
    

    So note that in Method 2 you should be using the "token" as the activity id. And the actual activity is not closed because you are ending only "activityid" whereas you should be using "token".

    Regards.

    • Marked as answer by btsdotnet Friday, November 27, 2015 6:44 AM
    Thursday, November 26, 2015 11:18 AM

All replies

  • Hi,

    Welcome on MSDN forum.

    I would suggest please have a look into below related thread for help,

    BAM entries not moving from ACTIVE to COMPLETED table


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Thursday, November 26, 2015 10:47 AM
    Moderator
  • Hi ,

    You need to set Continuation token When the components of the application are sending events to BAM asynchronously .

    Please refer  MSDN Link

     EventStream.EnableContinuation Method (String, String, String)

    https://msdn.microsoft.com/en-us/library/ee277534(v=bts.10).aspx

    Instrumenting a Solution: Step-by-Step API Usage

    Thanks

    Abhishek


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Thursday, November 26, 2015 10:57 AM
  • Method 1 should end with enabling continuation and then end activity. In Method 2 you will not begin but use the continuation token as activity id and when done use End Activity. Only then will the data be moved to completed table. Till the continuation is closed, the activity is considered active.

    So IMHO the activities should look like

    Method 1:

    OrchestrationEventStream.BeginActivity(ActivityName, ActivityId);
    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data1", data);
    OrchestrationEventStream.UpdateActivity(ActivityName, ActivityId, "Data2", data);
    OrchestrationEventStream.EnableContinuation(ActivityName, ActivityId, token);
    OrchestrationEventStream.EndActivity(ActivityName, ActivityId);
    

    and Method 2:

    OrchestrationEventStream.UpdateActivity(ActivityName, token, "Data11", data);
    OrchestrationEventStream.UpdateActivity(ActivityName, token, "Data22", data);
    OrchestrationEventStream.EndActivity(ActivityName, token);
    

    So note that in Method 2 you should be using the "token" as the activity id. And the actual activity is not closed because you are ending only "activityid" whereas you should be using "token".

    Regards.

    • Marked as answer by btsdotnet Friday, November 27, 2015 6:44 AM
    Thursday, November 26, 2015 11:18 AM
  • Thanks @shankycheil, it worked!
    Friday, November 27, 2015 6:45 AM