Open apveitas opened 10 years ago
hello :)
that sounds good, how would that work exactly? would it be enough to set a custom set of options for the retry queue or it would need some extra code to support it?
btw, have you tried extending the RabbitMqMinionPool class and override any needed methods by your own?
Hi Marcelo,
RE: btw, have you tried extending the RabbitMqMinionPool class and override any needed methods by your own?
No, I have not yet tried that and that would be an easy thing to do.
Conceptually, the code would look something like this:
RabbitMqMinionPool.prototype.createRetryQueue = function(
connection, exchangeName, queueName, args, callback
) {
var args = {};
var name = this.retryNameFor(queueName);
var self = this;
if (this.mqOptions.autoResubmittalToWorkerExchange) {
args['x-dead-letter-exchange'] = exchangeName;
args['x-message-ttl'] = this.mqOptions.retryTimeout;
}
this.createQueue(connection, name, args, this.retryNameFor(exchangeName), queueName, callback);
};
So to answer your original question, we would just add on additional option 'autoResubmittalToWorkerExchange' and wrap code to set the dlx xchange and ttl on the retry queue (as shown in code above)
In some cases, if a message was not consumed properly by a worker (i.e. message.reject()) we would like to put the message into the retry queue and not have the minionpool place it back into worker queue (after ttl expires) in the current automatic fashion.