In my scenario, I'm sending messages to a ServiceBus Queue. I have an azure function that is being triggered on that Queue. The function receives the message, checks status using some other API endpoint, if it's processed I send out an email. But when the processing of that request is not complete, I want to put the message on the queue (with some delay or scheduled time later in the future) so that function receives the same message again and checks again. The order doesn't necessary matter that much for me.
I have tried these approaches so far:
BrokeredMessage.Abandon() - which immediately triggers the function - not desirable behavior BrokeredMessage.Abandon() with ScheduledEnqueueTimeUtc property -- same behavior
BrokeredMessage.Defer() - here i need to keep track of message sequence number to receive the message using OnReceive - not convenient (or even possible within a function?)
Resending the same message to the queue with ScheduledEnqueueTimeUtc property set to later time - For this i need to get reference to the Queue Client again and send the message -- THIS sort of works but feels wrong (as i have to complete the actual message i received and dispatch another message from within the function).
Moreover, I've tried using WebJobs and Azure Storage Queue - pretty much same issues i encountered there.
Is there any better way to get this done? I'm open to use other approaches as well. I'm not sure if I can achieve something similar with LogicApp?
Thanks Sanjay