You're viewing archived documentation for @imqueue/core v2.0.26. APIs may differ from the current release. View the latest version ↗

RedisQueue class

Class RedisQueue Implements simple messaging queue over redis.

Signature:

export declare class RedisQueue extends EventEmitter<EventMap> implements IMessageQueue 

Extends: EventEmitter<EventMap>

Implements: IMessageQueue

Constructors

Constructor

Modifiers

Description

(constructor)(name, options, mode)

Constructs a new instance of the RedisQueue class

Properties

Property

Modifiers

Type

Description

name

string

options

IMQOptions

This queue instance options

{IMQOptions}

redisKey

readonly

string

This queue instance unique key (identifier), for internal use

Methods

Method

Modifiers

Description

clear()

Clears queue data in redis

destroy()

Gracefully destroys this queue

isPublisher()

Returns true if publisher mode is enabled on this queue, false otherwise.

{boolean}

isWorker()

Returns true if worker mode is enabled on this queue, false otherwise.

{boolean}

publish(data, toName)

Publishes a message to this queue subscription channel for currently subscribed clients.

If toName specified will publish to PubSub with a different name. This can be used to implement broadcasting some messages to other subscribers on other PubSub channels.

queueLength()

Retrieves the current count of messages in the queue

send(toQueue, message, delay, errorHandler)

Sends a given message to a given queue (by name)

start()

Initializes and starts current queue routines

stop()

Stops current queue routines

subscribe(channel, handler)

Creates a subscription channel over redis and sets up channel data read handler

unsubscribe()

Closes subscription channel

{Promise}