Azure Servicebus queue, BrokeredMessage.SequenceNumbers are not continuous

76 Views Asked by At

I'm using this MessageReceiver.ReceiveBatchAsync Method to receive a batch of messages from a service bus queue.

https://learn.microsoft.com/zh-cn/dotnet/api/microsoft.servicebus.messaging.messagereceiver.receivebatchasync?view=azure-dotnet

BrokeredMessage has a SequenceNumber, but sometimes the numbers are not continuous. Does that mean some messages lost.

How can I make this continuous?

1

There are 1 best solutions below

0
On BEST ANSWER

BrokeredMessage has a SequenceNumber, but sometimes the numbers are not continuous. Does that mean some messages lost

The message sequence is set on the broker whenever the broker receives messages. So if you have scheduled messages and it's not the time yet, you'll have a gap between message sequence numbers. Messages are not lost once received by the broker. You shouldn't use sequence numbers as indicators.