๐Ÿง  Temporal Basic Architecture

Understanding Core Concepts with Visual Diagrams

This presentation helps students clearly understand the core concepts of Temporal: Workflow, Activity, Worker, and how they relate.

We'll simplify the internal architecture and illustrate the flow of execution.


๐Ÿ“˜ Core Definitions

Workflow

The main orchestrator. Defines what should happen and in what order.

  • โœ… Durable
  • โœ… Stateful
  • โœ… Resumable

Activity

A unit of work that does the actual job (e.g., sending emails, processing payments).

  • โœ… Stateless
  • โœ… Retryable
  • โœ… Can timeout

Core Definitions Continued

Worker

A process/service that hosts Workflow and Activity implementations and polls the Temporal server for tasks.

Temporal Server

Manages state, schedules tasks, handles retries and failures. Think of it as the brain behind the system.


๐Ÿ“ˆ Architecture Diagram

graph TD subgraph Client Side A[Client] -->|Start Workflow| B(Workflow Stub) end subgraph Temporal Server B -->|Schedule Workflow Task| C[Workflow Execution] C -->|Schedule Activity Task| D[Activity Task Queue] end subgraph Worker Process E[Worker] -->|Polls| D E -->|Execute Activity| F[Activity Implementation] F -->|Return result| C end C -->|Return final result| A

๐Ÿ“ How to Read the Diagram

Step-by-step flow:

  1. Client initiates a Workflow using a stub (proxy)
  2. The Workflow code is executed by the Worker, but orchestrated by the Temporal Server
  3. The Workflow schedules Activities, which are picked up and executed by Workers
  4. Workers send back results to the Workflow
  5. The Workflow resumes or finishes

๐Ÿ’ก Key Concepts Comparison

Concept Durable Stateless Retry/Timeout Logic Hosted By
Workflow โœ… โŒ Handled by Temporal Worker
Activity โŒ โœ… Handled by Temporal Worker
Worker N/A N/A N/A You

Key Insight: Temporal handles all the complex retry and state management for you!


โœ… Best Way to Remember

Mental Model Analogy:

  • ๐Ÿง  Workflow = Brain (plans what to do)
  • ๐Ÿคฒ Activity = Hands (do the actual work)
  • ๐Ÿค– Worker = Robot (runs the brain and moves the hands)
  • ๐Ÿข Temporal Server = Mission Control (coordinates everything)

๐ŸŽฏ Why This Architecture Matters

Separation of Concerns:

  • Orchestration logic (Workflow) vs Business logic (Activity)
  • Stateful coordination vs Stateless execution

Reliability:

  • Workflows survive crashes and resume where they left off
  • Activities can be retried automatically
  • Everything is durable and observable

๐Ÿš€ Ready for the Journey?

This basic understanding and mental model will make every following lesson click more easily.

Key Takeaway:

Think in flows, not functions!

Your mind is now prepared to tackle Temporal workflows with confidence.


results matching ""

    No results matching ""