Requeue function

please help me how to use requeue function

Hey there @passionate-joey, thanks for posting. Please read the “Troubleshooting” and “How to Ask for Help” buttons below. If you would like a 1:1 support session from the KumoMTA team, details are at the “Book a Support Session” button below.

Hi guys, if possible can you please do let me know which requeue function should I used

kumo.on(‘requeue_message’, function(message))
or
kumo.on(‘message_requeued’, function(msg)
local queue = msg:get_queue_name()
if queue ~= SMART_HOST and msg:num_attempts() >= 2 then
– Re-route to alternative infra to manage the rest of the send
msg:set_meta(‘queue’, SMART_HOST)
– clear any scheduling constraints, as they do not apply
– when sending via a smart host
msg:set_scheduling(nil)
end
end)

As, I can see the function used in sample code is different and the function name in the docs is different, please help me to write the correct function.

reference https://docs.kumomta.com/reference/events/requeue_message/

Ah, it should be requeue_message. I’ve pushed a fix for the docs.

Please fix this statement as well

“If the effective queue name for the message is changed as a result of dispatching the ----message_requeued— event, then the message will be immediately eligible for delivery in the context of its new queue, however, if the message has scheduling constraints set via msg:set_scheduling those will remain in effect unless you explicitly clear them”

This is now fixed and I am marking this as RESOLVED