Skip to content

amqpx v1.0.1


amqpx / index / Queue

Interface: Queue ​

Defined in: src/queue/queue.ts:6

Methods ​

assert() ​

assert(): Promise<Queue>

Defined in: src/queue/queue.ts:17

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<Queue>


bindExchange() ​

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

Defined in: src/queue/queue.ts:32

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<Queue>


createBatchConsumer() ​

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

Defined in: src/queue/queue.ts:46

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
options?BatchConsumerOptions<T>

Returns ​

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


createConsumer() ​

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

Defined in: src/queue/queue.ts:39

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
options?ConsumerOptions<T>

Returns ​

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


createProducer() ​

createProducer<T>(options?): Promise<Producer<T, T>>

Defined in: src/queue/queue.ts:58

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
options?ProducerOptions<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<Producer<T, T>>


name() ​

name(): Promise<string>

Defined in: src/queue/queue.ts:23

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

Returns ​

Promise<string>

Released under the MIT License.