I take a message from the queue, process it, and for some messages at some point I understand that I need to wait a few seconds before trying to process it.
Options:
I can call sleep () and wait, but sometimes there may be hundrends of messages and luanching that many workers are not an option.
I can just request a message, but is this a good idea? I will process it again and again with the same result. (Processing includes waiting for DB, etc.)
I can send myself a new message, including a timestamp, to find out if the time has come to process the message or not. So on arriaval, I just check the timestamp, and if it goes well to normal processing.
Obviously the third way is better, but is it necessary to send these messages to the same exchange / queue, or is it a good idea to create a different exchange "processing_pass2"? Maybe there are some @rabbitMQ built-in functions to accomplish such a task? Will the requeue message appear again after the specified number of seconds?
source share