-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Library name
Azure.Messaging.ServiceBus
Please describe the feature.
When using the ServiceBusSessionReceiver
or ServiceBusReceiver
to receive a batch of messages, messages may be out of order when send and receive calls are happening simultaneously. This happens only when you have a sequence like the following: receive call ends because there are no more messages, more messages come in before the next receive call is started. This causes the receiver to release those in between messages since the excess credits are not being drained by default. When released, the service places them behind any additional messages that come in after the start of the call to receive.
To remedy this, consider adding an additional option to drain the excess receive credit. This option would hurt performance when used with concurrency, since credits could have been taken by other calls, so it must be an optional parameter set by the user. This option would presumably be the most useful in the ServiceBusSessionReceiver, where the ordering of batches is important.