Skip to main content

Worker Service

worker-service is implemented for the thin slice.

Responsibilities:

  • Connect to NATS JetStream.
  • Consume device.discovered.
  • Require tenant_id from the event envelope.
  • Set tenant context before database work.
  • Run rule evaluation, alert creation, integration delivery orchestration, evidence creation, and audit emission.
  • Poll due integration delivery retries from Postgres under explicit tenant context.
  • Claim retry work transactionally so future worker replicas do not process the same retry at the same time.
  • Ack only after successful processing.

The worker shares backend code with the API but runs as a separate process/container.