Entity & Lifecycle Patterns
These patterns model long-lived business entities as Workflows and keep those Workflows healthy as they run for days, months, or indefinitely. They cover how an entity holds and mutates state, how you bound Workflow history growth, and how you manage timers that change over time.
Patterns in this section
Entity Workflow
Models a long-lived business entity as a single Workflow that persists for the entity's entire lifetime, handling every state transition through Signals and Updates.
Continue-As-New
Prevents unbounded history growth by completing the current execution and starting a fresh one that carries forward the current state.
Updatable Timer
Provides a timer you can extend, shorten, or cancel in response to Signals or Updates while the Workflow waits.
Choosing a pattern
You are modeling something with an ongoing lifecycle — an account, a device, a subscription: use an Entity Workflow as the single source of truth for that entity.
Your Workflow runs long enough to grow a large history: apply Continue-As-New to reset history while preserving state.
You need a wait that responds to new information: use an Updatable Timer instead of a fixed sleep.
Related sections
- Workflow Messaging Patterns — the Signals and Updates that drive entity state transitions
- Task Orchestration Patterns — decompose a large entity into child Workflows