Skip to content

amqpx v1.0.1


amqpx / index / ProducerOptions

Type Alias: ProducerOptions<T>

ProducerOptions<T> = object

Defined in: src/producer/types.ts:8

Type Parameters

Type Parameter
T

Properties

PropertyTypeDescriptionDefined in
channel?Channel | nullChannel to use for publishing. If null, the producer will create new channel.src/producer/types.ts:27
drainTimeout?numberFor how long to wait for a drain event when amqplib has a full buffer. Specified in milliseconds.src/producer/types.ts:32
errorWindow?numberDuring publishing, the channel may fail but the publisher won't receive info about it until later (e.g. by closing the channel). This property specifies a window in milliseconds. If the publisher receives an error from RabbitMQ, it considers all messages sent within that window as not delivered and will try to deliver them again. Note: this may result in more-than-once delivery. Set to 0 to disable this behavior entirely. Defaults to 5000ms.src/producer/types.ts:40
options?amqp.Options.PublishAdditional amqplib publish options passed directly to the underlying channel publish call.src/producer/types.ts:23
retryStrategy?RetryStrategyFor confirmed publish only, how to retry publishing of the message if the message is rejected by the receiving queue. Can be overridden per individual publish call via ProducerPublishOptions.retryStrategy. By default, uses exponential backoff with 10 retries and an initial wait time of 100ms.src/producer/types.ts:46
routingKey?RoutingKeyGenerator<T>Routing key to use when publishing messages. Can be a static string or a function that derives the key from the message. Defaults to an empty string.src/producer/types.ts:19

Methods

stringifyMessage()?

optional stringifyMessage(message): MaybePromise<Buffer<ArrayBufferLike>>

Defined in: src/producer/types.ts:13

Serialize the message into a Buffer before sending to RabbitMQ. Defaults to JSON serialization.

Parameters

ParameterType
messageT

Returns

MaybePromise<Buffer<ArrayBufferLike>>

Released under the MIT License.