Friday Fact: Logic App Standard Workflows can be configured to run in both stateful and stateless modes

Unlike Logic App Consumption, which is stateful by default, Logic App Standard Workflows can be configured to run in both stateful and stateless modes. These workflows cater to different use cases depending on whether you need to maintain state and history or optimize for speed and reduced resource usage.

Stateful Workflows

Stateful workflows maintain state information throughout their execution. They persist the state of the actions to storage, keeping a record of each action and trigger that occurs during the workflow. This includes saving inputs, outputs, and any intermediate states.

Key Characteristics:

  • Persistence: Each step’s state and output are saved to Azure Storage, which means if a workflow fails or needs to be paused, it can be resumed from the point of failure.
  • Durability: Stateful workflows are durable due to their persistence. They can handle long-running processes that might span minutes, hours, or even days.
  • Re-run and Resumption: Since the state is maintained, stateful workflows can be re-run from any specific point in their execution history (https://techcommunity.microsoft.com/t5/azure-integration-services-blog/announcing-public-preview-of-resubmitting-from-an-action-in/ba-p/3953428). This is particularly useful for troubleshooting or when handling errors.
  • History Tracking: All actions and triggers are logged, allowing for comprehensive monitoring and debugging. You can view a detailed run history of each workflow instance, including inputs, outputs, and actions taken.
  • Suitable for Long-Running Processes: Ideal for scenarios requiring long-running processes, approval workflows, or any process where maintaining a detailed history and ability to resume is critical.

Stateless Workflows

Stateless workflows, in contrast, do not persist any state information beyond the execution of the workflow. They do not save inputs, outputs, or intermediate states to storage. Each execution is independent, and no historical data is kept once the run completes.

Key Characteristics:

  • No Persistence: Stateless workflows execute actions without writing to storage, meaning they don’t retain state or history. Once an action is executed, its data is not saved.
  • High Performance: Because stateless workflows do not involve writing to storage or maintaining state, they can execute faster and consume fewer resources, making them suitable for high-throughput scenarios.
  • Low Latency: The lack of state persistence results in lower latency, making stateless workflows suitable for scenarios where speed is critical.
  • No History Tracking: Since stateless workflows don’t keep a history, you cannot view detailed logs of inputs and outputs after execution. Only basic metrics such as run status are available.
  • Suitable for Short-Lived Processes: This is ideal for scenarios that require simple, short-lived operations without the need for detailed tracking or resumption, like data transformations or simple API orchestration.

Main Differences Between Stateful and Stateless Workflows

FeatureStateful WorkflowsStateless Workflows
State PersistencePersists state and history to Azure StorageNo state persistence; each execution is stateless
PerformanceSlower due to storage operations and durability overheadFaster due to no storage writes and reduced latency
DurabilityDurable; can handle long-running processesNot durable; designed for short-lived, quick executions
ResumptionCan resume from the last known state after a failureNo resumption; each run is independent
History TrackingFull tracking of inputs, outputs, and actionsLimited tracking; only basic run status available
ConnectorsManaged connector triggers are available and allowedManaged connector triggers are unavailable or not allowed.
ChunkingSupports chunkingNo support for chunking
Async operationsSupports asynchronous operationsNo support for asynchronous operations

By understanding these differences, developers can choose the appropriate workflow type based on their specific application or process requirements.

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for my son!

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top