bullmq - v6.4.0
    Preparing search index...

    Class Relay<C>Experimental

    Routes messages between the nodes of a fleet: any process can publish on a topic, and every subscription matching it receives the message, wherever it runs.

    The routing logic (topic grammar, matching, subscriptions, node liveness and inboxes) lives in Lua scripts (Redis) or SQL functions (PostgreSQL) behind IRelayBackend; this class only runs timers, reads its inbox and calls listeners.

    Topics are dot-separated keypaths (queues.emails.jobs.42.progress). Patterns may use * (one segment) and > (one or more trailing segments).

    Events: 'error' (Error), 'recovered' (the node re-registered after its lease expired), 'swept' (string[] of removed node ids), 'lag' (number of unread messages, when it reaches lagThreshold).

    The API may change in minor releases while the relay is completed.

    Type Parameters

    Hierarchy

    • EventEmitter
      • Relay
    Index
    namespace: string
    nodeId: string
    • Experimental

      Stops this node and unregisters it, removing its subscriptions.

      Returns Promise<void>

    • Experimental

      Deletes the retained message of a topic: new subscribers no longer get it. Returns false if the topic had no retained message.

      Parameters

      • topic: string

      Returns Promise<boolean>

    • Experimental

      Namespaces in use in the datastore (or Redis prefix).

      Returns Promise<string[]>

    • Experimental

      A node's inbox connection (this node's by default), as the datastore sees it: its address and how long it has been open and idle. Empty when the node isn't connected. Lists every client of the datastore: use it on demand, not on a timer.

      Parameters

      • nodeId: string = ...

      Returns Promise<RelayNodeConnection[]>

    • Experimental

      Nodes of this namespace, in registration order. start and end are inclusive positions; an end of -1 means "to the end".

      Parameters

      • start: number = 0
      • end: number = -1

      Returns Promise<RelayNodeState[]>