Is there a way to cancel ALL scheduled messages in azure service bus topic without knowing their sequence numbers?

Viewed 668

Use case:

  1. We use a azure service bus topic.
  2. Based on a business rule, we sometimes schedule a message to be delivered to a topic at a future time.
  3. In case of system mis-configuration, we have a need to cancel all scheduled messages to a particular topic.
  4. We do not have sequence number for each of the scheduled message.

What I found so far:

Question:

  1. Is it possible to delete ALL scheduled messages to a particular topic without knowing any of their sequence numbers?
1 Answers

Short answer is "no".

When you schedule messages and know you would need to cancel some of those, you should hold on to the SequenceNumbers returned back when scheduling using client.CancelScheduledMessageAsync(sequenceNumber). I've blogged about this option here. I. Your case, you'd need a TopicClient to schedule messages.

Related