简体   繁体   中英

Azure Service Bus scheduled message arriving too late

I'm using ASB Topics. I'm connecting the service by using Microsoft .NET ServiceBus nuget (namespace Microsoft.Azure.ServiceBus.Core )

When a message arrive, my consumer either handles it and release the message or resending it to the topic with a delay.

The problem is that when the delay is less than 15 seconds, sometimes the message only arrive after 15 seconds.

eg setting the delay to 3s or 10s usually works fine, but some of the messages arrive only after 15s (in both 3s or 10s cases). When setting the delay to 20 seconds it works just fine with no exceptions.

It's for sure not load on the consumer because in some cases it was idle during the wait time.

I tried using prefetchCount but it had no effect.

I wanted to track the scheduled message in Azure UI but it seems that this option available for queues (not topics) only.

Any idea why is that happening and what can I do? thanks!

I'm using premium tier, my receiver runs in azure k8s. i'm quite sure this number 15s is defined somewhere to delay messages in certain cases. was wondering if someone knows about this.

You can queue or subject messages for later processing; for example, you can plan a job to be ready for processing by a system at a specific time. This functionality allows for the creation of a dependable distributed time-based scheduler.

Scheduled messages do not appear in the queue until the enqueue time has passed. Scheduled messages can be cancelled before that time. The communication is deleted when you cancel it.

You can use any of our clients to schedule messages in one of two ways:

Use the standard send API, but before sending, set the ScheduledEnqueueTimeUtc property on the message.

Pass both the standard message and the planned time to the schedule message API. This will return the SequenceNumber of the planned message, which you can use to cancel it later if necessary.

For more information please refer the below links:

MICROSOFT DOCUMENTATION:- Scheduled messages & Best Practices for performance improvements using Service Bus Messaging

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM