Promise that resolves when consumer has fully stopped
Manual shutdown
const stop = await outbox.start()
// Later...
await stop()
console.log('Consumer stopped gracefully')
Shutdown with timeout
const stop = await outbox.start()
process.on('SIGTERM', async () => {
console.log('Shutting down...')
const timeout = setTimeout(() => {
console.error('Shutdown timeout, forcing exit')
process.exit(1)
}, 5000)
await stop()
clearTimeout(timeout)
console.log('Shutdown complete')
})
Start - The function that returns this stop function
Function type that stops the outbox consumer gracefully.
When called, this function: