SHAR Workflow
What is SHAR?
SHAR is a stateless workflow engine and toolkit for running long-lived business processes with durable execution, service task workers, and message-driven orchestration. It’s designed for distributed systems where reliability matters: work is persisted, retried when needed, and coordinated through NATS events rather than in-memory state.
Core concepts
Workflows & processes
A workflow defines one or more processes. A process is an executable definition that the engine runs as a sequence/graph of activities (e.g., service tasks, timers, gateways).
Service tasks
Service tasks are units of work implemented by external workers. Workers subscribe to task execution messages, perform the work, and report completion/failure back to the engine. Tasks are versioned and can be organized into sets for routing and operational control.
Variables
Processes carry variables throughout execution. Tasks can read inputs and produce outputs, and workflows can apply output mappings/transforms to shape results.
Reliability: retries and failure handling
Tasks can be configured with retry behavior (attempt counts, backoff/interval strategies, and “what to do when retries are exceeded”). This makes failure handling explicit and consistent across task types.
Compensation (saga-style rollback)
For processes that need safe rollback, SHAR supports compensation: when cancellation or failure requires unwinding completed work, the engine executes compensation steps in reverse order of the original successful actions.
Architecture at a glance
- Engine / Server: Executes workflow state transitions and coordinates task scheduling.
- Client / CLI: Loads workflows, launches processes, registers tasks, and runs workers.
- Messaging & persistence: Uses a message bus with durable storage to ensure progress survives restarts and transient failures.
- Observability: Logging and telemetry hooks help trace executions and diagnose issues.
For a deeper dive into SHAR’s architecture and features, check out the Advanced Topics.
Common workflows
- Orchestrating a multi-step business transaction across services
- Scheduled or timer-driven processes
- Human + automation flows (user tasks + service tasks)
- Strong retry semantics for unreliable dependencies
- Saga workflows with explicit compensation steps
Where to look next
Check out the quickstart guide for a hands-on introduction to creating a service task for SHAR.