Core Idea

Stateless Choreography is a workflow coordination pattern where services in a choreographed system reconstruct workflow state on-demand through queries rather than storing it.

Definition

Stateless Choreography is a workflow coordination pattern where services in a choreographed system reconstruct workflow state on-demand through queries rather than storing it. Each service maintains local state within its Bounded-Context but derives overall workflow status by querying other services. This eliminates centralized state storage while preserving choreography’s decentralized nature.

Key Characteristics

  • On-demand state reconstruction: Workflow state built dynamically by querying services, not stored centrally
  • Local state ownership: Each service maintains only its bounded context state
  • Query-based coordination: Services expose read APIs for workflow progress determination
  • No persistent workflow state: No single service tracks complete workflow unlike Front-Controller-Pattern
  • Reduced coupling: Loose coupling through events and query interfaces
  • Eventual consistency: Workflow state view may be temporarily inconsistent

Examples

  • E-commerce order: Order Service queries Payment, Inventory, and Shipping APIs to reconstruct order status—no service stores “order completed” state
  • Multi-step approval: Document Service queries Legal, Security, Compliance services for approval records to determine overall status
  • Distributed saga: Participants expose query endpoints for transaction status; coordinator reconstructs global state by querying all
  • Serverless workflows: Stateless functions query databases/services to determine next workflow step without in-memory state

Why It Matters

Stateless choreography enables scalable, fault-tolerant workflows by eliminating centralized state storage bottlenecks and single points of failure. Services scale independently without coordinating state mechanisms. Suits Event-Driven-Architecture-Style and Microservices-Architecture-Style prioritizing loose coupling and autonomous evolution.

Trade-offs: increased network traffic from queries, potential inconsistency due to Eventual-Consistency, and implementation complexity. Best for workflows where state changes are infrequent relative to queries and eventual consistency is acceptable.

Sources

  • Ford, Neal; Richards, Mark; Sadalage, Pramod; Dehghani, Zhamak (2022). Software Architecture: The Hard Parts. O’Reilly Media. ISBN: 9781492086895.

    • Chapter 11: Stateless choreography pattern for workflow state management
  • Filippone, Giulio; Pompilio, Claudio; Autili, Marco (2023). “An architectural style for scalable choreography-based microservice-oriented distributed systems.” Computing, Vol. 105, pp. 1779-1808. DOI: 10.1007/s00607-023-01153-4

  • Takahashi, K.; Ikegaya, T.; Katayanagi, R. (2020). “A Workflow-less Autonomous System Architecture for Assurance Operations using Choreography Architecture.” CNSM 2020, pp. 1-5. DOI: 10.1109/CNSM50862.2020.9269057

  • Barker, Adam (2007). Flexible Service Choreography. PhD Thesis, University of Edinburgh.

  • Microsoft Azure Architecture Center (2024). “Choreography Pattern.” Cloud Design Patterns.

Note

This content was drafted with assistance from AI tools for research, organization, and initial content generation. All final content has been reviewed, fact-checked, and edited by the author to ensure accuracy and alignment with the author’s intentions and perspective.