Hermes MongoDB
    Preparing search index...

    Type Alias Start

    Start: () => Promise<Stop>

    Function type that starts the outbox consumer and returns a stop function.

    When called, this function:

    1. Checks MongoDB version compatibility
    2. Ensures indexes are created
    3. Loads or creates consumer state
    4. Opens a Change Stream
    5. Begins processing events

    Type Declaration

      • (): Promise<Stop>
      • Returns Promise<Stop>

        Promise that resolves to a Stop function for graceful shutdown

    Basic start/stop

    const outbox = createOutboxConsumer({ ... })

    // Start consuming
    const stop = await outbox.start()
    console.log('Consumer started')

    // Later, gracefully stop
    await stop()
    console.log('Consumer stopped')

    Automatic cleanup with shouldDisposeOnSigterm

    const outbox = createOutboxConsumer({
    // ...
    shouldDisposeOnSigterm: true // Default behavior
    })

    const stop = await outbox.start()
    // Consumer will automatically stop on SIGTERM/SIGINT
    // No need to manually call stop() in signal handlers

    Stop - The returned shutdown function