Abhijeet
Abhijeet

Reputation: 13886

How to Cancel scheduled Message in Azure Topic

As the title says, Is it possible to cancel scheduled message delivery to a topic?

Background:

I am using message scheduling in topic. I generally schedule the message delivery after 10 minutes. It works fine. Based on certain business logic, I need to cancel a scheduled message. Is it feasible?

Upvotes: 1

Views: 834

Answers (2)

Libin Joseph
Libin Joseph

Reputation: 7392

From version 3.3.1 , you can now do this.

var sequenceNumber = await queueClient.ScheduleMessageAsync(message, DateTimeOffset.UtcNow.AddSeconds(300)).ConfigureAwait(false);
await queueClient.CancelScheduledMessageAsync(sequenceNumber).ConfigureAwait(false);

Upvotes: 2

b2zw2a
b2zw2a

Reputation: 2693

It looks like you can't. Have look at this video - Service Bus Messaging Deep-Dive around 1:36:50:

It won't be visible other than accumulating in storage quota and you also can't cancel it

Your best option is to wait for the message, receive it and handle cancellation in the logic.

Upvotes: 0

Related Questions