@lastshotlabs/slingshot-orchestration-bullmq
npm install @lastshotlabs/slingshot-orchestration-bullmq
Functions
Section titled “Functions”classifyOrchestrationError
Section titled “classifyOrchestrationError”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): ErrorClassificationSource: packages/slingshot-orchestration-bullmq/src/errorClassification.ts
createBullMQOrchestrationAdapter
Section titled “createBullMQOrchestrationAdapter”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 & BullMQOrchestrationHealthCapabilitySource: packages/slingshot-orchestration-bullmq/src/adapter.ts
createBullMQTaskProcessor
Section titled “createBullMQTaskProcessor”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; }): voidSource: packages/slingshot-orchestration-bullmq/src/taskWorker.ts
createBullMQWorkflowProcessor
Section titled “createBullMQWorkflowProcessor”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
mapBullMQStatus
Section titled “mapBullMQStatus”Map BullMQ job states onto the portable orchestration run status enum.
function mapBullMQStatus(state: JobState | 'paused' | 'unknown'): RunStatusSource: packages/slingshot-orchestration-bullmq/src/statusMap.ts
Constants
Section titled “Constants”bullmqJobRetentionSchema
Section titled “bullmqJobRetentionSchema”Job retention defaults applied when individual jobs do not specify
removeOnComplete/removeOnFail. Without these, Redis memory grows
unbounded as completed/failed jobs accumulate.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
removeOnCompleteAge | Seconds to retain completed jobs before removal (default 3600). |
removeOnCompleteCount | Maximum number of completed jobs retained per queue (default 1000). |
removeOnFailAge | Seconds to retain failed jobs before removal (default 86400). |
removeOnFailCount | Maximum number of failed jobs retained per queue (optional). |
Source: packages/slingshot-orchestration-bullmq/src/validation.ts
bullmqOrchestrationAdapterOptionsSchema
Section titled “bullmqOrchestrationAdapterOptionsSchema”Validation schema for the BullMQ orchestration adapter factory options.
Source: packages/slingshot-orchestration-bullmq/src/validation.ts
bullmqTlsOptionsSchema
Section titled “bullmqTlsOptionsSchema”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).
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
ca | PEM-encoded CA certificate used to verify the Redis server certificate. |
cert | PEM-encoded client certificate for mTLS authentication with Redis. |
key | PEM-encoded client private key for mTLS authentication with Redis. |
rejectUnauthorized | Whether to reject connections with unverified TLS certificates. Default true. |
Source: packages/slingshot-orchestration-bullmq/src/validation.ts
Classes
Section titled “Classes”BullMQConnectionError
Section titled “BullMQConnectionError”Error raised when the BullMQ adapter cannot establish or maintain a connection to Redis.
Source: packages/slingshot-orchestration-bullmq/src/errors.ts
BullMQOrchestrationError
Section titled “BullMQOrchestrationError”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
Interfaces
Section titled “Interfaces”ErrorClassification
Section titled “ErrorClassification”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
BullMQJobRetentionOptions
Section titled “BullMQJobRetentionOptions”Job retention defaults controlling how long completed and failed jobs are kept in Redis.
Source: packages/slingshot-orchestration-bullmq/src/validation.ts
BullMQOrchestrationAdapterOptions
Section titled “BullMQOrchestrationAdapterOptions”Typed options accepted by createBullMQOrchestrationAdapter().
Source: packages/slingshot-orchestration-bullmq/src/validation.ts
BullMQTlsOptions
Section titled “BullMQTlsOptions”TLS options forwarded to the ioredis connection when connecting to Redis over TLS.
Source: packages/slingshot-orchestration-bullmq/src/validation.ts
Exports
Section titled “Exports”BullMQOrchestrationAdapterMetrics
Section titled “BullMQOrchestrationAdapterMetrics”Cumulative operational counters exposed by the BullMQ orchestration adapter.
Source: packages/slingshot-orchestration-bullmq/src/adapter.ts
BullMQOrchestrationHealthCapability
Section titled “BullMQOrchestrationHealthCapability”Adapter capability that probes BullMQ orchestration health and Redis connectivity.
Source: packages/slingshot-orchestration-bullmq/src/adapter.ts
BullMQOrchestrationMetricsCapability
Section titled “BullMQOrchestrationMetricsCapability”Adapter capability that returns BullMQ orchestration metrics snapshots.
Source: packages/slingshot-orchestration-bullmq/src/adapter.ts
OrchestrationAdapterDisposedError
Section titled “OrchestrationAdapterDisposedError”Error thrown when callers reuse a BullMQ orchestration adapter after shutdown.
Source: packages/slingshot-orchestration-bullmq/src/adapter.ts