Interface: Producer<T, WholeMessage>
Defined in: src/producer/producer.ts:28
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<WholeMessage>>
Type Parameters
| Type Parameter | Default type |
|---|---|
T | - |
WholeMessage | T |
Accessors
channel
Get Signature
get channel():
Channel
Defined in: src/producer/producer.ts:48
The channel used by this producer for publishing.
Returns
Methods
close()
close(
timeout?):Promise<void>
Defined in: src/producer/producer.ts:35
Stops accepting new publishes and waits for all pending publish operations to settle.
Parameters
| Parameter | Type | Description |
|---|---|---|
timeout? | number | Maximum milliseconds to wait for pending publishes to settle. Throws 'Producer close timed out' if exceeded. Waits 30s when omitted. |
Returns
Promise<void>
publish()
publish(
message,routingKey?,options?):Promise<WholeMessage>
Defined in: src/producer/producer.ts:43
Publishes a message to RabbitMQ.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | T | Message 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? | ProducerPublishOptions | Per-publish options such as a retry strategy override. |
Returns
Promise<WholeMessage>