Skip to content

amqpx v1.0.1


amqpx / index / QueueImplementation

Class: QueueImplementation

Defined in: src/queue/queue-implementation.ts:18

Implements

Constructors

Constructor

new QueueImplementation(channel, queueName, options?): QueueImplementation

Defined in: src/queue/queue-implementation.ts:22

Parameters

ParameterType
channelChannel
queueNamestring
options?QueueOptions

Returns

QueueImplementation

Methods

assert()

assert(): Promise<QueueImplementation>

Defined in: src/queue/queue-implementation.ts:34

Verify the queue against the broker, according to the configured assertionMode.

  • Assert (default) — declare the queue; creates it if absent, throws on config mismatch.
  • Check — verify the queue exists without creating it; throws if absent.
  • Passive — no-op; no network call is made.

Subsequent calls return immediately once the first call completes successfully. Returns this to allow chaining.

Returns

Promise<QueueImplementation>

Implementation of

Queue.assert


bindExchange()

bindExchange(exchange, pattern, args?): Promise<QueueImplementation>

Defined in: src/queue/queue-implementation.ts:69

Bind this queue to an exchange. Asserts the queue first if it has not been asserted yet.

Parameters

ParameterTypeDescription
exchangeExchangeExchange to bind this queue to.
patternstringRouting key pattern under which to bind.
args?BindingArgsOptional AMQP headers or x-arguments for the binding.

Returns

Promise<QueueImplementation>

Implementation of

Queue.bindExchange


createBatchConsumer()

createBatchConsumer<T>(options?): Promise<BatchConsumer<T, Record<string, unknown>>>

Defined in: src/queue/queue-implementation.ts:81

Create batch consumer for current queue. By default, creates a new dedicated channel for the consumer. Pass a channel in options to use a specific one instead.

Type Parameters

Type Parameter
T

Parameters

ParameterType
optionsBatchConsumerOptions<T>

Returns

Promise<BatchConsumer<T, Record<string, unknown>>>

Implementation of

Queue.createBatchConsumer


createConsumer()

createConsumer<T>(options?): Promise<Consumer<T, Record<string, unknown>>>

Defined in: src/queue/queue-implementation.ts:75

Create consumer for current queue. By default, creates a new dedicated channel for the consumer. Pass a channel in options to use a specific one instead.

Type Parameters

Type Parameter
T

Parameters

ParameterType
optionsConsumerOptions<T>

Returns

Promise<Consumer<T, Record<string, unknown>>>

Implementation of

Queue.createConsumer


createProducer()

createProducer<T>(options?): Promise<ProducerImplementation<T>>

Defined in: src/queue/queue-implementation.ts:87

Create producer for current queue. Publishes via the default RabbitMQ exchange, routing messages directly to this queue by name. By default, creates a new dedicated channel for the producer. Pass a channel in options to use a specific one instead.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
optionsProducerOptions<T> & objectOptional producer options (serialization, routing key, hooks, …). Set options.isConfirmed to true to open the dedicated channel in confirm mode. Has no effect when options.channel is supplied.

Returns

Promise<ProducerImplementation<T>>

Implementation of

Queue.createProducer


name()

name(): Promise<string>

Defined in: src/queue/queue-implementation.ts:65

Returns the name of the queue. Asserts the queue first if it has not been asserted yet.

Returns

Promise<string>

Implementation of

Queue.name

Released under the MIT License.