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
Function type that starts the outbox consumer and returns a stop function.
When called, this function: