amqpx / index / ConsumerOptions
Type Alias: ConsumerOptions<T>
ConsumerOptions<
T> =object
Defined in: src/consumer/types.ts:80
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
channel? | Channel | null | Channel to use for consuming. If null (default), a new dedicated channel is created. | src/consumer/types.ts:112 |
consumeOptions? | Omit<amqp.Options.Consume, "noAck"> | Options passed down into amqplib.channel.consume function. Auto acknowledgement is controlled by the failureStrategy property instead. | src/consumer/types.ts:99 |
failureStrategy? | ConsumptionFailureStrategy | How to handle a RabbitMQ message when the handler throws an error. Options are: - Drop: acknowledges the message as successfully processed even when the handler throws. - Requeue: rejects the message and returns it to the queue so a different consumer can process it. - Reject: rejects the message and moves it to the dead letter queue if one is configured. | src/consumer/types.ts:88 |
prefetch? | number | How many messages the RabbitMQ broker can send to the consumer in parallel. This effectively controls the concurrency of the consumer. Defaults to 0, which means the broker can send as many messages as it wants. Warning: prefetch is configured on the channel. It is recommended to use a separate channel per consumer so that different prefetch values do not interfere with each other. | src/consumer/types.ts:108 |
Methods
parseMessageFn()?
optionalparseMessageFn(payload):MaybePromise<T>
Defined in: src/consumer/types.ts:94
Function that parses the message received by Rabbit. By default it calls JSON.parse, but you may provide your own function to parse message in XML or Proto format.
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | Buffer | content of the rabbit message. |
Returns
MaybePromise<T>