workflow-orchestration-patterns

Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.

Author

Install

Hot:7

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-workflow-orchestration-patterns&locale=en&source=copy

Workflow Orchestration Patterns - Temporal

Skills Overview

Master the workflow orchestration architecture for building reliable distributed systems with Temporal. Cover key patterns such as separation of workflows and activities, the Saga compensation pattern, state management, and determinism constraints. Use these patterns to build long-running processes, distributed transactions, and microservice orchestration.

Use Cases

  • Multi-step processes across services: When business workflows must span multiple machines, services, or databases, and reliable state coordination is required—such as e-commerce order processing, payment flows, and inventory management.
  • Long-running workflows that must recover reliably: When workflows may run from hours to years and must automatically recover from any failure point—such as account lifecycle management, infrastructure automation, and entity lifecycle tracking.
  • Distributed transactions that require compensation: When you need “all-or-nothing” transactional semantics across multiple services and can execute compensating actions on failure—such as booking systems, money transfers, and multi-step business approvals.
  • Core Capabilities

  • Saga Compensation Transaction Pattern: Register a compensating operation for each step. On failure, execute all compensations in reverse order (LIFO). This enables controlled rollback of distributed transactions and is suitable for atomic business scenarios such as payments, inventory, and fulfillment.
  • Entity Workflows (Actor Model): Model a single entity instance (cart, account, inventory item) as a long-running independent workflow. Receive state changes via signals, fetch the current state via queries. This naturally encapsulates entity behavior and ensures consistency.
  • Parallel Task Orchestration (Fan-Out/Fan-In): Use child workflows or parallel activities to distribute large-scale tasks and aggregate results. Follow the principle of “do not scale a single workflow,” split 1M tasks into 1K child workflows × 1K tasks, achieving horizontal scaling.
  • Common Questions

    What is the fundamental difference between Workflow and Activity in Temporal?

    A Workflow is the orchestration logic layer. It contains business decision-making and coordination logic, must be deterministic (the same inputs produce the same outputs), and cannot directly call external systems. An Activity is the external interaction layer that handles all non-deterministic operations such as API calls, database writes, and network requests. Quick summary: Workflow decides “what to do,” Activity executes “how to do it.”

    When should you not use Temporal workflow orchestration?

    For scenarios such as simple CRUD operations (directly using APIs), pure data-processing pipelines (use Airflow or batch processing), stateless request-response (use standard REST APIs), and real-time stream processing (use Kafka or event processors). In these cases, you don’t need the complexity of workflow orchestration.

    Why must Activities be idempotent?

    Temporal automatically retries Activities in cases like network failures or timeouts. This means the same Activity may be executed multiple times. Idempotency ensures “executing N times is equivalent to executing 1 time.” Common approaches include using idempotency keys for deduplication, performing checks before operations with unique constraints, using Upsert instead of Insert, and tracking already processed request IDs.