Time to receive a message on a Azure ServiceBus topic


I have a topic created on an Azure service bus, and I can put messages on it, and recover them, everything is fine.

But I want to be able to have a message placed on the queue, but somehow set the filter on the subscription to ignore the message until a time set on / in the message. For example: "Here's a job, but I do not want you to do it before 5:00 tonight."

I tried adding a SqlFilter, but got lost with it. I found online examples of highMessages and lowMessages, based on numbers, but I can not make it work with a SubscriptionClient.

Is it possible, or should I simply delay adding the message to the queue until I'm ready to process it?

The answer

The filters are intended for filtering based on message metadata (headers) and not linked to a clock. Looks like you want to postpone a message. You can send your messages and set ScheduledEnqueueTimeUtc property to the time you want the message to be processed. Note that (citing MSDN):

The message queuing time does not mean that the message will be sent at the same time. It will be queued, but the actual send time depends on the workload of the queue and its state.