Releases: transcovo/node-amqp-bus
Releases · transcovo/node-amqp-bus
Handling client connection `close` event
This release improves how apps handle when the client connection to the server is closed abruptly (such as a restart of the rabbitmq server), by exiting the current process, while giving the app ways to cleanup properly.
(the orchestrator of the env. should then spawn a new instance instead)
Added:
Client EventEmitter interface:
close_cleanup
: emitted once, when handling aclose
connection event.
It provides a timeout (defaut =200ms
) before executing aclient.close(forceClose = true)
,
for the host app to execute any cleanup operations (such as closing amongodb
client).
Client options:
- @param {Number|undefined} [options.processExitCleanupTimeout] :
the time in ms that is (at least) waited for close cleanup operations. (default:200ms
) - @param {Number|undefined} [options.processExitTimeout] :
the time in ms that is (at least) waited before exiting process. (default:0ms
)
Changes:
client.close(forceClose = false)
Closes the client. Returns a Promise. When passing a truthyforceClose
,close()
will alsoexit(1
) the current process, so when handling erroneous case that you can't recover from, one should callclose(true)
.