Skip to content

amqpx v1.0.1


amqpx / index / ProducerImplementation

Class: ProducerImplementation<T> ​

Defined in: src/producer/producer-implementation.ts:17

Represents service sending messages into the RabbitMQ. The generic properties are Message (the content published by the client), and WholeMessage that can contain additional properties that can be added by the producer implementation.

Extends ​

  • EventEmitter<ProducerEventMap<T>>

Type Parameters ​

Type Parameter
T

Implements ​

Constructors ​

Constructor ​

new ProducerImplementation<T>(channel, exchange, options?): ProducerImplementation<T>

Defined in: src/producer/producer-implementation.ts:24

Parameters ​

ParameterType
channelChannel
exchangeExchange
optionsProducerOptions<T>

Returns ​

ProducerImplementation<T>

Overrides ​

EventEmitter<ProducerEventMap<T>>.constructor

Properties ​

PropertyModifierTypeDefined in
channelreadonlyChannelsrc/producer/producer-implementation.ts:25

Methods ​

close() ​

close(timeout?): Promise<void>

Defined in: src/producer/producer-implementation.ts:49

Stops accepting new publishes and waits for all pending publish operations to settle.

Parameters ​

ParameterTypeDefault valueDescription
timeoutnumber30_000Maximum milliseconds to wait for pending publishes to settle. Throws 'Producer close timed out' if exceeded. Waits 30s when omitted.

Returns ​

Promise<void>

Implementation of ​

Producer.close


publish() ​

publish(message, routingKey?, options?): Promise<T>

Defined in: src/producer/producer-implementation.ts:83

Publishes a message to RabbitMQ.

Parameters ​

ParameterTypeDescription
messageTMessage to publish. The producer implementation may augment it with additional properties.
routingKey?RoutingKeyGenerator<T>Either a static routing key string, or a generator function that derives the key from the message.
options?ProducerPublishOptionsPer-publish options such as a retry strategy override.

Returns ​

Promise<T>

Implementation of ​

Producer.publish

Released under the MIT License.