You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
Sometimes when QueueClient.ScheduleMessageAsync(Message, DateTimeOffset) is called, the returned sequence number is equal to 0, and the message is not added to the queue.
I had a look at the code and found that in method MessageSender.OnScheduleMessageAsync(Message), if the status of the AmqpResponseMessage is not AmqpResponseStatusCode.OK, a MessagingContractException is created, but never thrown. As a result, the caller receives 0 as a sequence number and has to test this value in order to determine wether the scheduling succeeded or not.
Expected Behavior
I suppose the MessagingContractException should be thrown when AmqpResponseMessage.StatusCode is not AmqpResponseStatusCode.OK.
Also, the current return statement return sequenceNumbers?.FirstOrDefault() ?? 0; makes me wonder if it's really possible for an AmqpResponse to contain zero sequence numbers (or several), when the operation is a ScheduleMessageOperation and it succeeded.
@fhyvrier
Thanks for debugging through the code and pointing out the exact error.
if it's really possible for an AmqpResponse to contain zero sequence numbers (or several), when the operation is a ScheduleMessageOperation and it succeeded.
Ideally, no. That should not happen. But the null checks there are just defensive coding. To think of it, throwing would be a better option than returning 0 even in that case. Will update the code accordingly.
Actual Behavior
Sometimes when
QueueClient.ScheduleMessageAsync(Message, DateTimeOffset)
is called, the returned sequence number is equal to 0, and the message is not added to the queue.I had a look at the code and found that in method
MessageSender.OnScheduleMessageAsync(Message)
, if the status of theAmqpResponseMessage
is notAmqpResponseStatusCode.OK
, a MessagingContractException is created, but never thrown. As a result, the caller receives 0 as a sequence number and has to test this value in order to determine wether the scheduling succeeded or not.Expected Behavior
I suppose the MessagingContractException should be thrown when
AmqpResponseMessage.StatusCode
is notAmqpResponseStatusCode.OK
.Also, the current return statement
return sequenceNumbers?.FirstOrDefault() ?? 0;
makes me wonder if it's really possible for anAmqpResponse
to contain zero sequence numbers (or several), when the operation is aScheduleMessageOperation
and it succeeded.Versions
The text was updated successfully, but these errors were encountered: