amqpx / index / ProducerOptions
Type Alias: ProducerOptions<T>
ProducerOptions<
T> =object
Defined in: src/producer/types.ts:8
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
channel? | Channel | null | Channel to use for publishing. If null, the producer will create new channel. | src/producer/types.ts:27 |
drainTimeout? | number | For how long to wait for a drain event when amqplib has a full buffer. Specified in milliseconds. | src/producer/types.ts:32 |
errorWindow? | number | During 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.Publish | Additional amqplib publish options passed directly to the underlying channel publish call. | src/producer/types.ts:23 |
retryStrategy? | RetryStrategy | For 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()?
optionalstringifyMessage(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
| Parameter | Type |
|---|---|
message | T |
Returns
MaybePromise<Buffer<ArrayBufferLike>>