Hermes PostgreSQL
    Preparing search index...

    Type Alias UseAsyncOutboxPolicy<Message>Template

    UseAsyncOutboxPolicy: (
        hermes: OutboxConsumer<Message>,
    ) => IAsyncOutboxConsumer<Message>

    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

    Type Parameters

    • Message extends JSONValue

    Type Declaration

    // 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)
    })
    }