TemplateThe parent outbox consumer instance
Configured async outbox consumer
// Custom policy implementation
const myAsyncPolicy: UseAsyncOutboxPolicy<DomainEvent> = (hermes) => {
return createAsyncOutboxConsumer({
consumerName: hermes.getCreationParams().consumerName,
getSql: () => hermes.getDbConnection(),
publish: async (envelope) => {
// Custom publishing logic
await myCustomHandler(envelope)
},
checkInterval: Duration.ofSeconds(30)
})
}
Policy function type that creates an async outbox consumer.
This type defines a function that takes a parent OutboxConsumer and returns an IAsyncOutboxConsumer configured to work with it.
Message - The type of domain messages/events