Skip to content

[JOBS]: Introduce a transactional outbox and durable background worker #96

Description

@grantfox-oss

Context

Emails, notifications, audit records, storage cleanup, and blockchain reconciliation are side effects of database changes. Executing them inline couples request success to external services; executing them after commit without durable coordination can lose work.

Scope

  • Add an outbox model written in the same transaction as domain changes.
  • Build a worker with atomic claiming, visibility timeout/lease, heartbeat, bounded retries, and dead-letter handling.
  • Define versioned event payloads and idempotent consumers.
  • Implement initial consumers for transactional email and one operational side effect.
  • Add replay, inspection, and redrive tooling with audit records.
  • Define retention and safe payload redaction.

Acceptance criteria

  • A committed domain change always leaves durable side-effect work.
  • Rolling back the domain transaction creates no outbox event.
  • Worker crashes and duplicate delivery do not duplicate logical side effects.
  • Poison messages stop retrying and remain inspectable/redrivable.
  • Queue depth, oldest age, attempts, and failures are observable.
  • Integration tests exercise concurrent workers and crash recovery.

Relevant areas

Prisma models, payout/application/support mutations, email-service.ts, future notifications and escrow reconciliation.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions