TemplateOptionalasyncPolicy for configuring a separate async outbox consumer.
The async outbox is used for non-critical messages like compensations.
Unique name for this consumer instance.
Used to create a PostgreSQL replication slot.
Function that returns PostgreSQL connection options.
Postgres.js connection options
OptionalmaxMaximum number of transactions waiting to be published or acknowledged.
When the limit is reached, Hermes stops reading the replication stream, so PostgreSQL holds the changes
in the WAL instead of the consumer holding them in memory. Reading resumes once the queue drops to half the limit.
With serialization: false, it also caps the number of concurrent publish calls.
OptionalnowFunction that returns the current date/time.
OptionalonCallback invoked when a database error occurs.
OptionalonCallback invoked when message publishing fails.
OptionalpartitionPartition key for horizontal scaling.
Callback invoked when Hermes delivers a message.
If this callback completes successfully, the message is acknowledged. If it throws an error, the message will be retried.
Single message or array of messages to publish
OptionalsaveWhether to save processing timestamps for each message.
⚠️ Use with caution: Significantly increases I/O operations.
OptionalserializationWhether to process messages serially (one at a time) or concurrently.
OptionalshouldWhether to automatically stop the consumer on SIGTERM/SIGINT signals.
OptionalwaitDuration to wait after a failed publish attempt before retrying.
Configuration parameters for creating an outbox consumer.
Message - The type of domain messages/events this consumer will handle
Example