0
votes

In my current project I have an idea of using filters/rules on topic's subscription for a custom retry policy.

I get a message from a topic in an Azure Function and try to send it to a remote service. If the service throws a Timeout exception, I want to add a custom property named PostponeUntil with a specific date-time (for example, in an hour) to the message, add it to the topic again and then use a rule on a subscription to filter out this message until it is the time for a retry. Is it possible to do with SqlFilter something like this:

 var filter = new Microsoft.Azure.ServiceBus.SqlFilter("GETDATE() = PostponedUntilDateTime");

If not, what are the alternatives for a scenario that I have?

1

1 Answers

1
votes

For sending messages to Service Bus Queues and Topics with time delay, you should make use of scheduled messaging.

You can schedule a message to a Topic with a specific time, so that it will be en-queued into the Topic only at the specified time.

ScheduleMessageAsync is the methods you should use for achieving it.

Look here for more details about Scheduled Messages.