Scenario:
A helper class is created to log activities using BufferedEventStream class available with BAM API. We created an instance of this helper class in orchestrations and called various methods from the helper class to ActivityStart, Error, EndActivity, ActivityUpdate etc.
Issue:
We observed that, some of the entries we logged using UpdateActivity method are randomly not stored into BAMPrimaryImport database(thus not showing up on BAM Portal). We also observed that, UpdateActivity call prior to EndActivity call seems to be having this issue more often.
Fix:
In each BAM API call in the helper class, we are creating new BufferedEventStream object. Since BufferedEventStream is asynchronous in nature and we are creating separate instances of these, I suspected that there could be random cases where UpdateActivity calls might be logged after EndActivity calls. I read from the documentation that, EndActivity should be the last method to be called. So we then created an instance varible of type BufferedEventStream and used it in all calls rather than creating separate instance of it in every method. After doing this, we did not find any issues with activity entries on BAM portal.
We have spent quite a bit of time to troubleshoot this issue with few other alternatives until we finally figured out the fix. I hope this post helps and saves time, if any one else finds similar issues.
A helper class is created to log activities using BufferedEventStream class available with BAM API. We created an instance of this helper class in orchestrations and called various methods from the helper class to ActivityStart, Error, EndActivity, ActivityUpdate etc.
Issue:
We observed that, some of the entries we logged using UpdateActivity method are randomly not stored into BAMPrimaryImport database(thus not showing up on BAM Portal). We also observed that, UpdateActivity call prior to EndActivity call seems to be having this issue more often.
Fix:
In each BAM API call in the helper class, we are creating new BufferedEventStream object. Since BufferedEventStream is asynchronous in nature and we are creating separate instances of these, I suspected that there could be random cases where UpdateActivity calls might be logged after EndActivity calls. I read from the documentation that, EndActivity should be the last method to be called. So we then created an instance varible of type BufferedEventStream and used it in all calls rather than creating separate instance of it in every method. After doing this, we did not find any issues with activity entries on BAM portal.
We have spent quite a bit of time to troubleshoot this issue with few other alternatives until we finally figured out the fix. I hope this post helps and saves time, if any one else finds similar issues.