prorm API Reference
    Preparing search index...

    Class NsqStore

    NsqStore wraps a single producer Writer plus a pool of consumer Readers (keyed by topic/channel) and exposes the common queue surface. NSQ has no server-side job registry, so getJob()/remove() (which imply addressing a job by id) are not supported and throw.

    Implements

    Index
    name: "nsq" = 'nsq'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "nsqjs" = 'nsqjs'

    The client library being used

    • Publish a message to a topic via the producer Writer. The payload is JSON-serialized (strings/Buffers pass through). NSQ does not return a client-visible job id, so this resolves to null.

      Parameters

      • queue: string
      • jobData: unknown

      Returns Promise<null>

    • Subscribe a Reader to queue (topic) on a channel and invoke handler(msg) for each delivered message. One reader is cached per topic/channel; a repeat process() on the same pair returns it.

      Parameters

      • queue: string
      • handler: (msg: any) => void | Promise<void>
      • opts: NsqProcessOptions = {}

      Returns Promise<any>

    • Not supported: NSQ exposes no server-side lookup of a message by id.

      Parameters

      • _queue: string
      • _id: string

      Returns Promise<never>

    • Not supported: NSQ messages are acknowledged via finish(), not removed by id.

      Parameters

      • _queue: string
      • _id: string

      Returns Promise<never>

    • Return a lightweight local view of consumers for a topic: the number of active Readers this store has bound to it. (NSQ's authoritative stats live in nsqd's HTTP /stats endpoint, not the client library.)

      Parameters

      • queue: string

      Returns Promise<{ topic: string; readers: number }>