Let us consider an device(s) which continuously send its activity message to a azure queue as Q1 .On that each message,i have 2 properties one is MessageContent and another one is time when we need to push that MessageContent into another queue as Q2. My question is please help in finding the gap(mechanism to trigger message from Q1 to Q2 based on the time configuration) between the queues.
Asked
Active
Viewed 877 times
2 Answers
2
That's what ScheduledEnqueueTimeUtc
property of BrokeredMessage
class is for. Use it like this:
var message = new BrokeredMessage(content)
{
ScheduledEnqueueTimeUtc = timeToSend
};
queueClient.Send(message);
So, if I understood you correctly, Q1 processor should read the content and timeToSend
from Q1 and enqueue the message to Q2 as shown above.
Documentation, note the remark:
Message enquing time does not mean that the message will be sent at the same time. It will get enqueued, but the actual sending time depends on the queue's workload and its state.

Mikhail Shilkov
- 34,128
- 3
- 68
- 107
-
can you please tell me about the factors which cause queue's workload ? – Skull Jun 22 '17 at 12:27
-
@Skull How many messages are enqueued vs processed. If you have a backlog in the queue, your scheduled message processing will happen later than schedule time. – Mikhail Shilkov Jun 22 '17 at 12:29
-
I would also assume it would only happen later if there's lots of messages in the queue. – juunas Jun 22 '17 at 12:57
0
For Core 3.1, ServiceBusSender is coming from using Azure.Messaging.ServiceBus:
var serviceBusMessage = new ServiceBusMessage
{
ScheduledEnqueueTime = DateTime.UtcNow.AddMilliseconds(30000),
Body = new BinaryData(message)
};
await sender.SendMessageAsync(serviceBusMessage).ConfigureAwait(false);
You can use ScheduledEnqueueTime
to delay a message delivery.

סטנלי גרונן
- 2,917
- 23
- 46
- 68

Varun Sood
- 11
- 3