Skip to content

@lastshotlabs/slingshot-orchestration-bullmq

npm install @lastshotlabs/slingshot-orchestration-bullmq

Classify an error as transient (retryable) or permanent (fail-fast) based on known OS-level and Redis-level error codes. Used by the BullMQ adapter to decide whether a failed job should be retried or surfaced immediately.

function classifyOrchestrationError(err: unknown): ErrorClassification

Source: packages/slingshot-orchestration-bullmq/src/errorClassification.ts

Create the BullMQ-backed orchestration adapter.

Use this adapter when the app already runs Redis and wants durable queues, repeatable schedules, and worker-based task execution without changing task or workflow code.

function createBullMQOrchestrationAdapter(rawOptions: BullMQOrchestrationAdapterOptions & { eventSink?: OrchestrationEventSink; workflowConcurrency?: number; structuredLogger?: Logger; /** * Optional `HookServices` for in-process workflow hooks and task contexts. * Provided by the orchestration plugin when the bullmq worker is colocated * with the main app process. When the worker runs in a separate process * (no app reference), omit this and tasks/hooks see `services: undefined`. */ hookServices?: import('@lastshotlabs/slingshot-core').HookServices; },): OrchestrationAdapter & ObservabilityCapability & ScheduleCapability & BullMQOrchestrationMetricsCapability & BullMQOrchestrationResetCapability & BullMQOrchestrationHealthCapability

Source: packages/slingshot-orchestration-bullmq/src/adapter.ts

Create the BullMQ task processor used by task workers and named task queues.

function createBullMQTaskProcessor(options: { taskRegistry: Map<string, AnyResolvedTask>; eventSink?: OrchestrationEventSink; logger?: Logger; /** * Optional `HookServices` to thread into every task's `TaskContext.services`. * Provided by the bullmq adapter when the task worker shares a process with * the main app. When the worker runs in a separate process (services * unreachable), this is omitted and tasks see `services: undefined`. */ hookServices?: import('@lastshotlabs/slingshot-core').HookServices; }): void

Source: packages/slingshot-orchestration-bullmq/src/taskWorker.ts

Create the BullMQ workflow processor that walks workflow steps and dispatches child task jobs onto the appropriate BullMQ queues.

function createBullMQWorkflowProcessor(options: { workflowRegistry: Map<string, AnyResolvedWorkflow>; taskRegistry: Map<string, AnyResolvedTask>; getTaskQueue(taskName: string): Queue; getTaskQueueEvents(taskName: string): QueueEvents; eventSink?: OrchestrationEventSink; logger?: Logger; /** * Optional `HookServices` for workflow `onStart`/`onComplete`/`onFail` hooks. * Provided by the bullmq adapter when the worker process is also the main app * process (services accessible). When the worker runs in a separate process * (no app reference), services is `undefined`. */ hookServices?: import('@lastshotlabs/slingshot-core').HookServices; })

Source: packages/slingshot-orchestration-bullmq/src/workflowWorker.ts

Map BullMQ job states onto the portable orchestration run status enum.

function mapBullMQStatus(state: JobState | 'paused' | 'unknown'): RunStatus

Source: packages/slingshot-orchestration-bullmq/src/statusMap.ts

Job retention defaults applied when individual jobs do not specify removeOnComplete/removeOnFail. Without these, Redis memory grows unbounded as completed/failed jobs accumulate.

FieldDescription
removeOnCompleteAgeSeconds to retain completed jobs before removal (default 3600).
removeOnCompleteCountMaximum number of completed jobs retained per queue (default 1000).
removeOnFailAgeSeconds to retain failed jobs before removal (default 86400).
removeOnFailCountMaximum number of failed jobs retained per queue (optional).

Source: packages/slingshot-orchestration-bullmq/src/validation.ts

Validation schema for the BullMQ orchestration adapter factory options.

Source: packages/slingshot-orchestration-bullmq/src/validation.ts

TLS settings forwarded to the underlying ioredis connection. All fields are optional; pass them when connecting to Redis behind TLS (e.g. ElastiCache, Upstash, MemoryStore).

FieldDescription
caPEM-encoded CA certificate used to verify the Redis server certificate.
certPEM-encoded client certificate for mTLS authentication with Redis.
keyPEM-encoded client private key for mTLS authentication with Redis.
rejectUnauthorizedWhether to reject connections with unverified TLS certificates. Default true.

Source: packages/slingshot-orchestration-bullmq/src/validation.ts

Error raised when the BullMQ adapter cannot establish or maintain a connection to Redis.

Source: packages/slingshot-orchestration-bullmq/src/errors.ts

Base error for BullMQ-specific orchestration failures.

Adds an adapter field so consumers can identify which adapter backend produced the error when multiple orchestration adapters are in use.

Source: packages/slingshot-orchestration-bullmq/src/errors.ts

Outcome of error classification used to decide retry vs. fail-fast. permanent: true means the error must surface to the caller without retry.

Source: packages/slingshot-orchestration-bullmq/src/errorClassification.ts

Job retention defaults controlling how long completed and failed jobs are kept in Redis.

Source: packages/slingshot-orchestration-bullmq/src/validation.ts

Typed options accepted by createBullMQOrchestrationAdapter().

Source: packages/slingshot-orchestration-bullmq/src/validation.ts

TLS options forwarded to the ioredis connection when connecting to Redis over TLS.

Source: packages/slingshot-orchestration-bullmq/src/validation.ts

Cumulative operational counters exposed by the BullMQ orchestration adapter.

Source: packages/slingshot-orchestration-bullmq/src/adapter.ts

Adapter capability that probes BullMQ orchestration health and Redis connectivity.

Source: packages/slingshot-orchestration-bullmq/src/adapter.ts

Adapter capability that returns BullMQ orchestration metrics snapshots.

Source: packages/slingshot-orchestration-bullmq/src/adapter.ts

Error thrown when callers reuse a BullMQ orchestration adapter after shutdown.

Source: packages/slingshot-orchestration-bullmq/src/adapter.ts