Creates an instance of a Queue which is connected to either a regular amqplib.Channel
or a amqplib.ConfirmChannel
.
The name of the queue.
The connection client.
The connection channel.
The type of the channel.
Optional
instrumentors: Partial<QueueInstrumentors>Optional instrumentors for the queue.
Returns the name of the queue.
Removes the specified event listener for the 'error' event.
The name of the event to remove the listener from ('error').
The function to remove as a listener for the 'error' event.
Removes the specified event listener for the 'deleted' event.
The name of the event to remove the listener from ('deleted').
The function to remove as a listener for the 'deleted' event.
Removes the specified event listener for the 'message' event.
The name of the event to remove the listener from ('message').
The function to remove as a listener for the 'message' event.
Registers an event listener for the 'error' event.
The name of the event to listen for ('error').
The function to invoke when the 'error' event is emitted.
Registers an event listener for the 'deleted' event.
The name of the event to listen for ('deleted').
The function to invoke when the 'deleted' event is emitted.
Registers an event listener for the 'message' event.
The name of the event to listen for ('message').
The function to invoke when the 'message' event is emitted.
Registers a one-time event listener for the 'error' event. The listener will be invoked at most once for the event, and then removed.
The name of the event to listen for ('error').
The function to invoke when the 'error' event is emitted.
Registers a one-time event listener for the 'deleted' event. The listener will be invoked at most once for the event, and then removed.
The name of the event to listen for ('deleted').
The function to invoke when the 'deleted' event is emitted.
Registers a one-time event listener for the 'message' event. The listener will be invoked at most once for the event, and then removed.
The name of the event to listen for ('message').
The function to invoke when the 'message' event is emitted.
Acknowledges a message, indicating that it has been successfully processed and can be removed from the queue.
The message to acknowledge.
Optional
allUpTo: booleanWhether to acknowledge all messages up to and including the given message.
Wait for all ack
and nack
confirmations to be transmitted to the server, or timeout after a specified amount of time.
The amount of time to wait for confirmations to process before timing out.
1.0.11
Consumes messages from the queue as quickly as possible, invoking the given listener function for each message received.
Optional
listener: QueueMessageListenerThe function to invoke for each message received.
Optional
options: Partial<QueueConsumptionOptions>The options to use when consuming messages.
Optional
abortSignal: AbortSignalAn optional abort signal that can be used to cancel the listener.
noAck
, ackOnNoAck
, and nackOnNoAck
are all false
.Enqueues a message to the queue with the given content and options.
The content of the message to enqueue.
Optional
options: Partial<QueueEnqueueOptions>The options to use when enqueuing the message.
Retrieves a message from the queue with the given options.
Optional
options: Partial<GetMessagesOptions>The options to use when retrieving the message.
false
if no message is available.Listens for messages on the queue, invoking the given listener function for each message received.
Optional
listener: QueueMessageListenerThe function to invoke for each message received.
Optional
options: Partial<QueueListeningOptions>The options to use when listening for messages.
Optional
abortSignal: AbortSignalAn optional abort signal that can be used to cancel the listener.
1.0.16
noAck
, ackOnNoAck
, and nackOnNoAck
are all false
.Rejects a message, indicating that it has not been successfully processed and should be requeued or discarded.
The message to reject.
Optional
requeue: boolean = trueWhether to requeue the message or discard it.
Optional
allUpTo: boolean = falseWhether to reject all messages up to and including the given message.
Pauses the queue listener, preventing it from processing any new messages until resumed. If the queue is already paused, this method does nothing.
Optional
timeout: number = 1000The number of milliseconds to wait for the queue to finish processing confirmations before timing out.
1.0.10
An instance of a Queue which is connected to either a regular
amqplib.Channel
or aamqplib.ConfirmChannel
.