I’ve been looking into the requeue_message event to see if it is possible to set the retry interval on a transient failure on a per-message basis. Sadly, I don’t think it will work according to the docs unless I change the queue it is sitting on (which I don’t think I want in this case).
Is something like this theoratically possible with an event?
There are certain providers that return a dynamic value for e.g. greylists. For transactional mail I was tinkering with the idea of parsing the smtp response > requeuing with the provided delay in the response (with some jitter)
especially if the set default retry interval is ~5 minutes, but the provider returns “retry in 60 seconds” or (I’ve seen this one before):
retry in 900 seconds > we retry too soon > retry in 593 seconds
Ahh, so my understanding of requeue_message might work if I dynamically create a queue in there ad hoc, basically? (though I suppose that might harm performance, but theoratically speaking)
Yes, you could in theory build a queue for that retry period, but you will want to ensure it has a unique identifier. If you build a queue with the same name as the existing one the outcome will be unpredictable.
Interesting. My idea behind it was: as long as there’s a time indication in the response > ignore queue retry_interval and do not back off either > no time in the response (anymore)? > fallback to queue retry_interval and continue back off where it left off based on the number of attempts
It was just a quick idea that I played around with, it isn’t really a priority, but if I feel like it soon, I will see if I can play around with the source a bit more, who knows.