Skip to content

glide-mq ​

Classes ​

ClassDescription
BatchErrorThrown by batch processors to report per-job results (mixed success/failure).
BroadcastBroadcast - Fan-out message publisher for pub/sub patterns.
BroadcastWorker-
ConnectionErrorThrown when a Valkey/Redis connection cannot be established.
CycleError-
DelayedErrorInternal control-flow error thrown by job.moveToDelayed(). Caught by the Worker.
FlowProducerCreates parent-child job flows and DAG workflows. Children are processed first; the parent runs after all children complete.
GlideMQErrorBase error class for all glide-mq errors.
GroupRateLimitErrorInternal control-flow error thrown by job.rateLimitGroup(). Caught by the Worker.
JobRepresents a single job in the queue. Provides methods for reporting usage, streaming chunks, managing state, and interacting with the job lifecycle (delay, suspend, retry, etc.).
Producer-
QueueQueue manages job submission, retrieval, scheduling, and lifecycle operations. Connects to Valkey/Redis and uses server-side functions for atomic operations.
QueueEvents-
ServerlessPool-
SuspendErrorInternal control-flow error thrown by job.suspend(). Caught by the Worker.
UnrecoverableErrorThrown to signal a job failure that should never be retried, regardless of attempts config.
WaitingChildrenErrorInternal control-flow error thrown by job.moveToWaitingChildren(). Caught by the Worker.
Worker-

Interfaces ​

InterfaceDescription
AddAndWaitOptionsOptions for Queue.addAndWait(). Extends JobOptions with a wait timeout.
BatchOptionsConfiguration for batch processing mode.
BroadcastOptionsConfiguration options for a Broadcast (pub/sub) queue.
BroadcastWorkerOptionsConfiguration options for a BroadcastWorker (subscriber).
BudgetOptionsBudget constraints for a flow. Caps token usage and/or cost across all jobs.
ConnectionOptionsOptions for connecting to a Valkey/Redis server or cluster.
DAGFlowA complete DAG flow definition for submission via FlowProducer.addDAG().
DAGNodeA node in a DAG flow. Each node is a job with optional dependencies on other nodes. The deps array lists the names of nodes that must complete before this node can run.
DeadLetterQueueOptionsConfiguration for dead letter queue routing.
FlowJobDefinition of a job within a flow (parent-child hierarchy).
FlowProducerOptionsConfiguration options for creating a FlowProducer instance.
GetJobsOptionsOptions for getJob() and getJobs() methods.
GroupRateLimitOptionsOptions controlling behavior when job.rateLimitGroup() is called.
IamCredentialsIAM authentication credentials for AWS ElastiCache/MemoryDB.
IndexCreateOptionsOptions passed through to FT.CREATE (glide-mq owned, decoupled from speedkey).
JobCountsCount of jobs in each state.
JobDataGeneric job data payload type.
JobIndexOptionsOptions for creating a Valkey Search index over job hashes.
JobNode-
JobOptionsOptions for controlling individual job behavior (delay, priority, retry, etc.).
JobTemplateTemplate for jobs created by a scheduler.
JobUsageAI-specific usage metadata reported by a job processor.
MetricsAggregated metrics result with total count and per-minute data points.
MetricsDataPointA single per-minute metrics data point.
MetricsOptionsOptions for querying metrics data points.
PasswordCredentialsStandard password-based credentials.
ProducerOptions-
QueueEventsOptionsConfiguration options for creating a QueueEvents listener.
QueueOptionsConfiguration options for creating a Queue instance.
RateLimitConfigConfiguration for time-window rate limiting.
ReadStreamOptionsOptions for readStream() - reading entries from a job's streaming channel.
SandboxOptionsOptions for sandboxed (file-path) processors running in worker threads or child processes. When a job's abort signal fires (timeout or revocation), the abort is forwarded to the processor. If it has not settled 5 seconds later, its worker thread is terminated (or its child process is SIGKILLed) and replaced, so a hung processor cannot hold a sandbox slot. During that window the worker no longer owns the job: job.updateProgress(), job.updateData() and job.moveToDelayed() reject with Job aborted; job.log() still works.
ScheduleOptsOptions for defining a job schedule (cron, interval, or repeat-after-complete).
SchedulerEntryStored state of a registered job scheduler.
SearchJobsOptionsOptions for searchJobs() method.
SearchQueryOptionsOptions passed through to FT.SEARCH (glide-mq owned, decoupled from speedkey).
SerializerCustom serializer for job data and return values.
SignalEntryA signal entry delivered to a suspended job on resume.
SuspendOptionsOptions for suspending a job.
TokenBucketConfigConfiguration for token bucket rate limiting with burst capacity and refill rate.
UsageQueueSummaryAggregated usage totals for a single queue inside a usage summary response.
UsageSummaryRolling aggregate usage summary across one or more queues.
UsageSummaryOptionsOptions for aggregating reported usage across one or more queues.
VectorSearchOptionsOptions for vector similarity search over indexed jobs.
VectorSearchResultA single result from a vector similarity search.
WorkerInfoInformation about a live worker instance.
WorkerOptionsConfiguration options for creating a Worker instance. Extends QueueOptions.
WorkflowJobDef-

Type Aliases ​

Type AliasDescription
BatchProcessor-
ClosableWorkflowReturned workflow tree or DAG map plus close() for an injected client.
Field-
GracefulShutdownHandle-
Processor-
ReadFromRepresents the client's read from strategy.
WorkflowConnectionConnection for helpers. Pass client to keep returned jobs usable.

Variables ​

VariableDescription
JSON_SERIALIZERDefault JSON serializer used when no custom serializer is provided.
serverlessPoolModule-level singleton for convenient use in serverless handlers.

Functions ​

FunctionDescription
chainChain: execute jobs sequentially. Each step becomes a child of the next, so step N+1 only runs after step N completes. The last job in the array runs first; the first job in the array runs last and is the top-level parent.
chordChord: run a group of jobs in parallel, then execute a callback job with the results. The callback is the parent, the group members are children.
compileSubjectMatcherCompile an array of subject patterns into a single matcher function. Returns a function that returns true if the subject matches any pattern. Returns null if patterns is empty or undefined (no filtering).
dagDAG: submit a directed acyclic graph of jobs where each job can depend on multiple other jobs. The graph is validated for cycles and submitted in topological order (leaves first).
gracefulShutdownRegister SIGTERM and SIGINT handlers that gracefully close all provided components. Returns a Promise that resolves when all components have been closed. A second signal while shutdown is still running removes these handlers and re-raises that signal, so the process gets its default handling (exit) instead of the signal being swallowed behind a hung close().
groupGroup: execute jobs in parallel. All jobs run concurrently. A synthetic parent job (name: 'group') waits for all children. When complete, the parent's processor receives all children's results via getChildrenValues().
isClusterClientDetect whether a client is a GlideClusterClient. Uses instanceof with a duck-type fallback for cases where the client comes from a different copy/version of @glidemq/speedkey (dependency duplication).
isTracingEnabledTrue when a real OTel API is available (either user-provided or auto-detected).
matchSubjectMatch a dot-separated subject against a pattern. - * matches exactly one segment - > matches one or more trailing segments (must be the last token) - Literal tokens match exactly
setTracerAllow the user to supply their own tracer instance. If not called, the tracer is auto-resolved from @opentelemetry/api.
topoSortTopological sort of DAG nodes using Kahn's algorithm. Returns nodes in submission order (leaves first, roots last). Throws CycleError if a cycle is detected.
validateDAGValidate that a set of DAG nodes forms a valid DAG (no cycles). Throws CycleError if a cycle is detected. Throws Error if a node references a non-existent dependency.

Released under the Apache-2.0 License.