amqpx / index / ChannelImplementation
Class: ChannelImplementation
Defined in: src/channel/channel-implementation.ts:19
Extends
EventEmitter<ChannelEventMap>
Implements
Constructors
Constructor
new ChannelImplementation(
connection,publishConfirm):ChannelImplementation
Defined in: src/channel/channel-implementation.ts:24
Parameters
| Parameter | Type |
|---|---|
connection | Connection |
publishConfirm | boolean |
Returns
ChannelImplementation
Overrides
EventEmitter<ChannelEventMap>.constructor
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
connection | readonly | Connection | src/channel/channel-implementation.ts:25 |
Methods
checkQueue()
checkQueue(
name):Promise<AssertQueue>
Defined in: src/channel/channel-implementation.ts:121
Check whether a queue exists on the broker without asserting it. Resolves with queue metadata; rejects if the queue does not exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Queue name to inspect. |
Returns
Promise<AssertQueue>
Implementation of
close()
close(
timeout?):Promise<void>
Defined in: src/channel/channel-implementation.ts:73
Close the underlying amqplib channel. For confirm channels, waits for all pending confirmations before closing.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
timeout | number | 30_000 | Maximum milliseconds to wait for pending confirmations before closing. Throws 'Channel close timed out' if exceeded. Waits 30s when omitted. |
Returns
Promise<void>
Implementation of
connect()
connect():
Promise<ChannelImplementation>
Defined in: src/channel/channel-implementation.ts:35
Open the underlying amqplib channel. Must be called before any other operation. Subsequent calls are no-ops if the channel is already open.
Returns
Promise<ChannelImplementation>
Implementation of
createBatchConsumerForExchange()
createBatchConsumerForExchange<
T>(exchange,options,queueOptions?):Promise<BatchConsumer<T,Record<string,unknown>>>
Defined in: src/channel/channel-implementation.ts:226
Create a batch consumer that reads from an exchange using this channel. Internally asserts an exclusive queue and binds it to the exchange. Each consumer should have its own dedicated channel; this method uses the current channel. Consider using connection.createBatchConsumerForExchange or pass a channel in options param.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
exchange | Exchange | Source exchange. |
options | ExchangeBatchConsumerOptions<T> | Batch consumer options including the binding pattern. |
queueOptions? | ExchangeConsumerQueueOptions | Options for the auto-created exclusive queue binding. |
Returns
Promise<BatchConsumer<T, Record<string, unknown>>>
Implementation of
Channel.createBatchConsumerForExchange
createBatchConsumerForQueue()
createBatchConsumerForQueue<
T>(queue,options?):Promise<BatchConsumer<T,Record<string,unknown>>>
Defined in: src/channel/channel-implementation.ts:219
Create a batch consumer that reads from a queue using this channel. Each consumer should have its own dedicated channel; this method uses the current channel. Consider using connection.createBatchConsumerForQueue or pass a channel in options param.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | Queue | Source queue. |
options? | BatchConsumerOptions<T> | Optional batch consumer options (batch size, failure strategy, prefetch, …). |
Returns
Promise<BatchConsumer<T, Record<string, unknown>>>
Implementation of
Channel.createBatchConsumerForQueue
createConsumerForExchange()
createConsumerForExchange<
T>(exchange,options,queueOptions?):Promise<Consumer<T,Record<string,unknown>>>
Defined in: src/channel/channel-implementation.ts:212
Create a consumer that reads from an exchange using this channel. Internally asserts an exclusive queue and binds it to the exchange. Each consumer should have its own dedicated channel; this method uses the current channel. Consider using connection.createConsumerForExchange or pass a channel in options param.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
exchange | Exchange | Source exchange. |
options | ExchangeConsumerOptions<T> | Consumer options including the binding pattern. |
queueOptions? | ExchangeConsumerQueueOptions | Options for the auto-created exclusive queue binding. |
Returns
Promise<Consumer<T, Record<string, unknown>>>
Implementation of
Channel.createConsumerForExchange
createConsumerForQueue()
createConsumerForQueue<
T>(queue,options?):Promise<Consumer<T,Record<string,unknown>>>
Defined in: src/channel/channel-implementation.ts:205
Create a consumer that reads from a queue using this channel. Each consumer should have its own dedicated channel; this method uses the current channel. Consider using connection.createConsumerForQueue or pass a channel in options param.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | Queue | Source queue. |
options? | ConsumerOptions<T> | Optional consumer options (failure strategy, prefetch, …). |
Returns
Promise<Consumer<T, Record<string, unknown>>>
Implementation of
Channel.createConsumerForQueue
createExchange()
createExchange(
name,type,options?):Promise<Exchange>
Defined in: src/channel/channel-implementation.ts:113
Assert an exchange on the broker and return an Exchange handle.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Exchange name. |
type | string | Exchange type (direct, fanout, topic, headers, …). |
options? | ExchangeOptions | Optional exchange assertion options. |
Returns
Promise<Exchange>
Implementation of
createProducerForExchange()
createProducerForExchange<
T>(exchange,options?):Promise<Producer<T,T>>
Defined in: src/channel/channel-implementation.ts:198
Create a producer that publishes to an exchange using this channel. Each producer should have its own dedicated channel; this method uses the current channel. Consider using connection.createProducerForExchange or pass a channel in options param.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
exchange | Exchange | Target exchange. |
options | ProducerOptions<T> | Optional producer options (serialization, routing key, hooks, …). |
Returns
Promise<Producer<T, T>>
Implementation of
Channel.createProducerForExchange
createProducerForQueue()
createProducerForQueue<
T>(queue,options?):Promise<Producer<T,T>>
Defined in: src/channel/channel-implementation.ts:191
Create a producer that publishes directly to a queue using this channel. Each producer should have its own dedicated channel; this method uses the current channel. Consider using connection.createProducerForQueue or pass a channel in options param.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | Queue | Target queue. |
options | ProducerOptions<T> | Optional producer options (serialization, routing key, hooks, …). |
Returns
Promise<Producer<T, T>>
Implementation of
Channel.createProducerForQueue
createQueue()
createQueue(
name,options?):Promise<Queue>
Defined in: src/channel/channel-implementation.ts:117
Assert a queue on the broker and return a Queue handle.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Queue name. |
options? | QueueOptions | Optional queue assertion options. |
Returns
Promise<Queue>
Implementation of
native()
native():
Promise<Channel|ConfirmChannel>
Defined in: src/channel/channel-implementation.ts:126
Returns the underlying amqplib channel, connecting first if not already open. This is intended for internal use.
Returns
Promise<Channel | ConfirmChannel>
Implementation of
publish()
publish(
exchange,routingKey,content,optionsArgs):Promise<boolean>
Defined in: src/channel/channel-implementation.ts:133
Publish message directly using amqplib publish function. Handles backpressure (drain) and confirm-channel retries automatically. This is intended for internal use. Use createProducer* functions instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
exchange | string | Exchange name to publish to. |
routingKey | string | Routing key for the message. |
content | Buffer | Serialized message body. |
optionsArgs | ChannelPublishOptions | - |
Returns
Promise<boolean>
true if the broker confirmed receipt (confirm channel), false if fire-and-forget (non-confirm channel).