Skip to main content

Workflow Persistence Boundaries

Summary

One EF Core DbContext owns Workflow definitions, versions, steps, conditions, instances, tasks, actions, audit, timeline, processed-event and outbox records.

Aggregate mappings

Definitions cascade to versions, steps and conditions. Instances cascade to tasks and actions. Enum values are stored as strings; context, audit details, timeline metadata and outbox payload use structured JSON columns.

Constraints and indexes

Persistence enforces tenant/key uniqueness and definition/version uniqueness. Indexes support stage ordering, instance status/key lookup, user/role worklists, action lookup, chronological feeds, processed-event uniqueness and outbox processing.

Save boundary

Commands stage aggregate changes, audit and timeline records before calling one unit of work. SaveChangesAsync maps queued aggregate events to outbox messages before EF Core commits, then clears the domain-event queues.

Outbox boundary

The store selects pending or failed records in chronological batches. The shared processor marks messages processed or failed using subsequent saves.

Limitations

No explicit transaction orchestration beyond one DbContext save, concurrency tokens, archival/retention worker or processed-event consumer is implemented in this service.

Requires Confirmation

Retention, database transaction retry, outbox cleanup and production migration ownership require confirmation.

Source References

  • microservices/src/workflow-service/Infrastructure/WorkflowDbContext.cs
  • microservices/src/workflow-service/Infrastructure/Persistence.cs
  • microservices/src/workflow-service/Domain/Workflow/WorkflowDomainEvents.cs
  • microservices/src/workflow-service/Messaging/WorkflowIntegrationEvents.cs

See Also

Keywords

Workflow architecture, approval engine, Workflow Service, technical foundation.

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-20
  • Next review: 2026-10-20