Answer the question
In order to leave comments, you need to log in
How to write amqp rabbitmq message processing report?
I am writing on node.js, node-amqp driver, let's say the following code:
conn.queue(queueName, function(queue) {
queue.subscribe(function(msg) {
performQueueMessage(msg, function(err) {
// Сообщение обработали, возможно с ошибкой
});
});
});
Answer the question
In order to leave comments, you need to log in
You can simply include a message back in the queue by changing its status. There is no other way, and you don’t need it any other way, otherwise it will all result in problems if you have several queue handlers.
The task context is this.
Processing of each job from the queue can be very long up to several minutes, there are a lot of jobs. And if the node.js daemon crashes at that moment, I irretrievably lose messages.
Solutions:
1. Log "transactions" on the side of the node.js daemon and keep a log of messages taken for processing, their status, etc., so that when the daemon starts, you can watch incomplete transactions and try to complete them, say, by sending them back to the queue.
2. I am sure that rabbitmq should somehow do the same.
If option 2 is still impossible, then you will have to do with option 1, and wait until rabbitmq implements everything that is so lacking in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question