a message is scheduled using ScheduledEnqueueTime
into a service bus queue. now I want to delete the message while it is still scheduled (e.g scheduled in 5min but removed after 2min). is this possible? if so how do I do it?
CodePudding user response:
Using the sequence number of that message, you can cancel it before ScheduledEnqueueTime
and that cancelled message can be deleted.
Refer to this workaround contains the code used to cancel the Scheduled Message from Azure Service Bus Queue.
If the Schedule Time passed, then the queue gets appended with that message and it will even have a new sequence number.
Refer Message Sequencing and timestamps of Scheduled Messages on Azure Service bus Queue for more information.