You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const _ = require('lodash');
const config = ...
const rabbit = require('wascally');
const debug = require('debug')('wascally-helpers');
function exitOnConnectionClosed() {
debug("connection closed");
throw new Error("connection closed");
}
function exitOnConnectionFailed() {
debug("connection failed");
throw new Error("connection failed");
}
function setupRabbit(isExitOnClosed, isExitOnFailed) {
if (_.isUndefined(isExitOnClosed)) {
isExitOnClosed = true;
}
if (_.isUndefined(isExitOnFailed)) {
isExitOnFailed = true;
}
if (isExitOnClosed) {
rabbit.on('*.connection.closed', exitOnConnectionClosed);
}
if (isExitOnFailed) {
rabbit.on("*.connection.failed", exitOnConnectionFailed);
}
return rabbit
.configure(config)
.then(function () {
rabbit.nackOnError();
rabbit.nackUnhandled();
return rabbit;
});
}
module.exports = _.once(setupRabbit);
the reason behind the auto-exit, is as a best practice from node, on-error, exit and retry, this proved to be the most stable solution for a worker use-case
the problem with that, is that we're now seeing a lot of "flow" connections in rabbit, and also zombie consumers.
tried a lot of things :(
nothing helps
The text was updated successfully, but these errors were encountered:
@BlueHotDog if you want the process to exit on connection failure, why not call process.exit with a non-zero code? I don't think throwing an exception from a callback will cause the process to exit.
I'm not sure what you mean by "flow" connections. Wascally will only establish a single connection. If the connection is lost, it will continuously attempt to try and re-establish the connection, your topology and subscriptions. If you don't want that behavior, you need to manually close the connection with the close method.
This seems related to your recent comments on issue #107 - I'm not sure how a zombie consumer is possible as Rabbit kills all consumers and channels when a connection is dropped. If you mean you're seeing consumers because wascally is re-connecting and re-subscribing, that's intended behavior. Call close on the connection or exit the process if you don't want that behavior.
Hi, i've the following code:
the reason behind the auto-exit, is as a best practice from node, on-error, exit and retry, this proved to be the most stable solution for a worker use-case
the problem with that, is that we're now seeing a lot of "flow" connections in rabbit, and also zombie consumers.
tried a lot of things :(
nothing helps
The text was updated successfully, but these errors were encountered: