OptionalConnection: typeof RedisConnectionReadonlynameThe name of the queue.
Options for the queue.
ReadonlyqualifiedReturns a promise that resolves to a redis client. Normally used only by subclasses.
Returns the version of the Redis instance the client is connected to,
Stops consuming events and close the underlying Redis connection if necessary.
Force disconnects a connection.
Emits an event. Normally used by subclasses to emit events.
Alias for emitter.removeListener().
Adds the listener function to the end of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple
times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. Theemitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Adds a one-timelistener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. Theemitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Manually starts running the event consumming loop. This shall be used if you do not use the default "autorun" option on the constructor.
Wraps the code with telemetry and provides a span for configuration.
kind of the span: Producer, Consumer, Internal
operation name (such as add, process, etc)
destination name (normally the queue name)
code to wrap with telemetry
OptionalsrcPropagationMetadata: string
The QueueEvents class is used for listening to the global events emitted by a given queue.
This class requires a dedicated redis connection.