amqpx / index / ExchangeImplementation
Class: ExchangeImplementation
Defined in: src/exchange/exchange-implementation.ts:17
Implements
Constructors
Constructor
new ExchangeImplementation(
channel,exchangeName,exchangeType,options?):ExchangeImplementation
Defined in: src/exchange/exchange-implementation.ts:22
Parameters
| Parameter | Type |
|---|---|
channel | Channel |
exchangeName | string |
exchangeType | string |
options? | ExchangeOptions |
Returns
ExchangeImplementation
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
channel | readonly | Channel | src/exchange/exchange-implementation.ts:23 |
Methods
assert()
assert():
Promise<ExchangeImplementation>
Defined in: src/exchange/exchange-implementation.ts:35
Verify the exchange against the broker, according to the configured assertionMode.
Assert(default) — declare the exchange; creates it if absent, throws on config mismatch.Check— verify the exchange 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<ExchangeImplementation>
Implementation of
bindExchange()
bindExchange(
exchange,pattern,args?):Promise<ExchangeImplementation>
Defined in: src/exchange/exchange-implementation.ts:99
Bind another exchange to this exchange. Asserts the exchange first if it has not been asserted yet.
Parameters
| Parameter | Type | Description |
|---|---|---|
exchange | Exchange | Exchange to bind to this exchange. |
pattern | string | Routing key pattern under which to bind. |
args? | BindingArgs | Optional AMQP headers or x-arguments for the binding. |
Returns
Promise<ExchangeImplementation>
Implementation of
bindQueue()
bindQueue(
queue,pattern,args?):Promise<ExchangeImplementation>
Defined in: src/exchange/exchange-implementation.ts:71
Bind a queue to this exchange. Asserts the exchange first if it has not been asserted yet.
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | Queue | Queue to bind to this exchange. |
pattern | string | Routing key pattern under which to bind. |
args? | BindingArgs | Optional AMQP headers or x-arguments for the binding. |
Returns
Promise<ExchangeImplementation>
Implementation of
createBatchConsumer()
createBatchConsumer<
T>(options,queueOptions?):Promise<BatchConsumer<T,Record<string,unknown>>>
Defined in: src/exchange/exchange-implementation.ts:155
Creates a batch consumer for the current exchange. Internally asserts an exclusive queue and binds it to the exchange. Unless specified otherwise, uses the same channel as was used to declare the exchange. This is generally not recommended, as each consumer should have its own dedicated channel. Consider using connection.createBatchConsumerForExchange instead.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
options | ExchangeBatchConsumerOptions<T> |
queueOptions | ExchangeConsumerQueueOptions |
Returns
Promise<BatchConsumer<T, Record<string, unknown>>>
Implementation of
createConsumer()
createConsumer<
T>(options,queueOptions?):Promise<Consumer<T,Record<string,unknown>>>
Defined in: src/exchange/exchange-implementation.ts:145
Creates a consumer for the current exchange. Internally asserts an exclusive queue and binds it to the exchange. Unless specified otherwise, uses the same channel as was used to declare the exchange. This is generally not recommended, as each consumer should have its own dedicated channel. Consider using connection.createConsumerForExchange instead.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
options | ExchangeConsumerOptions<T> |
queueOptions | ExchangeConsumerQueueOptions |
Returns
Promise<Consumer<T, Record<string, unknown>>>
Implementation of
createProducer()
createProducer<
T>(options?):Promise<Producer<T,T>>
Defined in: src/exchange/exchange-implementation.ts:165
Creates a producer for the current exchange. Unless specified otherwise, uses the same channel as was used to declare the exchange. This is generally not recommended, as each producer should have its own dedicated channel. Consider using connection.createProducerForExchange instead.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
options | ProducerOptions<T> & object | Optional 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>>
Implementation of
name()
name():
Promise<string>
Defined in: src/exchange/exchange-implementation.ts:67
Returns the name of the exchange. Asserts the exchange first if it has not been asserted yet.
Returns
Promise<string>