Try for free Book a demo

Asynchronous Correlation with Turbo360 BAM

Distributed Tracing

4 Mins Read | Last modified on March 4th, 2024

distributed tracing transaction

One of the critical differences between distributed tracing and business activity monitoring is that distributed tracing usually assumes that your transaction executes from start to end in a reasonably short time. An example would be that your call to an API might then drop a message on a queue which a function processes and loads into a database. In the Microsoft eco-system, you could connect your components to Application Insights and get tracing, which would flow across these distributed components because the components use headers to wire together the telemetry from each component.

It begins to fall because telemetry of a continuous technical transaction does not have the concept of continuation, which could happen during a business event hour, days, weeks, or months later. It doesn’t have the idea of matching up events based on business values in other transactions.

An example of this might be if I send a message to a partner organization with an order in it, and the partner sends me an acknowledgment of receiving the order, an update the order was shipped, and then a confirmation that it was delivered. In these cases, the return messages could be via different protocols and various message formats and need to be matched up based on an order id. It is the typical BAM continuation scenario with which many people from a BizTalk background may already be familiar.

This article will look at how you can implement this scenario using the Car Appointments demo we have at Turbo360.

distributed tracing transaction

In this example, we have two interfaces. The first will export data from a SaaS application and convert it to a CSV appointment.

The 2nd interface will process response files coming back from the partner.

In the outgoing interface, we will start a BAM transaction for each record in the file. We can track that each appointment gets a response. The responses could come in different batch files over a while.

BAM Transaction setup

To start with, we will create the Car Appointment transaction in BAM. We will have stages indicating:

  • An appointment is sent to the garage
  • A response is received from the garage
  • The appointment is complete

The below picture shows what this looks like.

BAM Transaction

In the Send to Garage stage, we can configure properties from the message we will send on the diagram. In this case, I will give BAM the JSON message for this item extracted from the SaaS application. In the below image, you can see that I have a property called ID which is promoted from the “$.ID” property in the JSON data.

Stage properties

This ID property will be the business value which will be the correlation key for matching the responses from the garage back to this transaction.

Starting Transaction – Send Appointment Logic App

In my Logic App, which is used to create the appointments, I can use the Start Transaction shape to indicate to BAM that the transaction is started, and I pass BAM the JSON data in the message body, so the ID gets promoted.

Starting Transaction

Async Check Point – Response Logic App

In the Logic App that processes a response message, we do not need to use the Start Transaction shape because a BAM transaction is already running. Instead, we use the CheckPoint With Correlation shape.

This shape allows you to update a BAM Transaction to indicate a stage has been reached, but rather than passing in the transaction id, you are using a business value to find the transaction you want to update.

The diagram below shows that we are using the appointments ID property. While processing the event, BAM will look for a transaction with this ID as property and update the transaction to indicate the stage is reached.

distributed tracing transaction

BAM Tracking at Runtime

At runtime in BAM, you will see the list of transactions being processed, and you can see below that the appointments ID property is shown in the BAM transaction list.

distributed tracing transaction

If you open the transaction up, you will see that each stage has been completed.

BAM Tracking at Runtime

By using Check Point with Correlation to implement a continuation pattern, you can now do distributed tracing of business transactions which may execute in many different ways by matching events from different interfaces based on a business property.

This article was originally published on Sep 13, 2022. It was most recently updated on Mar 4, 2024.

Related Articles