Skip to content

Orchestration with BullMQ

Source-backed example app: examples/orchestration-bullmq/

Use this example when in-memory orchestration is no longer enough and workflow runs need to survive process restarts. It wires the BullMQ adapter into the orchestration plugin, protects the management routes, and shows how route middleware and request-context resolution attach to the orchestration surface.

  • createBullMQOrchestrationAdapter() with Redis connection settings
  • protected orchestration routes with routeMiddleware
  • request context resolution from headers
  • bounded job retention for completed and failed workflow jobs
  • examples/orchestration-bullmq/src/index.ts
  • examples/orchestration-bullmq/app.config.ts

Set requireTls: true in production and pass a real Redis TLS block. The example defaults to local Redis for development but the app.config.ts keeps TLS enabled so production config fails closed.

The example also sets shutdownDrainTimeoutMs and BullMQ retention limits. Those are operational controls, not cosmetic settings: they keep deploys from dangling workers and keep Redis from growing without bounds.