Transaction Scopes
In regular (transactional) workflows, each activity in the workflow is executed in a separate transaction and the workflow state changes and record data committed at the end of a transaction.
For in-memory workflows (designed for performance), the workflow states are not persisted to the database, but are maintained in the local cache. Typical in-memory workflows have sub-second responses. By persisting record changes at the end of the workflow instead of for each activity, the entire workflow becomes the scope of the transaction.
If there are any special activities or if any special conditions occur during the workflow execution, some variations in transaction scope exist:
In-Memory Workflow Condition | Transaction Scope |
---|---|
Has synchronous activities | From the first activity to the last activity of the workflow. |
Has asynchronous activities | From the first activity to the last activity of the workflow. |
Has InitiateSubflow activity executed in synchronous mode. (Subflow can only be an in-memory workflow). | From the first activity to the last activity of the parent workflow. No new transaction is initiated for the child subflow. |
Has InitiateSubflow activity executed in asynchronous mode. (Subflow can be in-memory or regular workflow). | The four transactions for this workflow are:
Transaction from the first activity of the parent workflow to the activity before the InitiateSubflow activity. Transaction for the subflow. Transaction from the InitiateSubflow activity to the last activity in the workflow. |
Has SpawnWorkflow activity executed in asynchronous mode. (Spawned workflow can be in-memory or regular) | The four transactions for this parent workflow are:
Transaction from the first activity of the parent workflow to the activity before the SpawnWorkflow activity. Transaction for the spawned workflow. Transaction from the SpawnWorkflow activity to the last activity in the parent workflow. |
Workflow suspends | The two transactions for this workflow are:
Transaction from the first activity of the parent workflow to the activity that suspends. Transaction from the suspended activity to the last activity in the workflow. |
Workflow errors out | From the first activity of the workflow to the last activity where the workflow errors out. |
Has CheckPointWorkflow activity. | The two transactions for this workflow are:
Transaction from the first activity of the parent workflow to the CheckPointWorkflow activity. Transaction from the activity after the CheckPointWorkflow activity to the last activity in the workflow. |