-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQ] Azure.Messaging.ServiceBus_7.0.0 - Add maxWaitTime parameter to ReceiveMessagesAsync #17581
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
The maxWaitTime parameter wasn't included on the IAsyncEnumerable because this method is most useful when you want to keep receiving messages indefinitely without needing the finer level of control that the ReceiveMessageAsync or other ReceiveMessagesAsync overload offer. Would either of those work for your scenario? |
Based on our use case ("trigger" a message that doesn't match the rules on the subscription and make sure that in a given period of time it isn't received) the IAsyncEnumerable method is the best candidate for us. We can't use the other ones because we also want to handle the scenarios when unrelated messages (from other manual or automated testing going on at the time of running the test) might be received as well. This means that we continue to receive messages and filter them based on a test controlled
And this is how we use it:
I agree that our use case is not really common, so I understand if the suggested feature doesn't make sense from a broader perspective. However, as mentioned initially, if we use a I understand that the intended use case is not to pass |
Thanks for the additional context. I think we can leave this issue open for now to track this feature request. |
Hi @cosminstirbu. Thank you, for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
Hi @cosminstirbu. There was a mistake and this issue was unintentionally flagged as a stale pull request. The label has been removed and the issue will remain active; no action is needed on your part. Apologies for the inconvenience. |
Closing this out for now as we have not seen any feedback indicating that this would be useful outside of the testing use case presented here. |
Library or service name.
Azure.Messaging.ServiceBus_7.0.0
Is your feature request related to a problem? Please describe.
We are using Azure.Messaging.ServiceBus to write integration tests that check the rules we have set on our subscriptions.
Some of these tests are checking that unintended messages are not received by a subscription.
To do this we're using
public virtual IAsyncEnumerable<ServiceBusReceivedMessage> ReceiveMessagesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
by passing aCancellationToken
that uses aTimeStamp
.However it seems that the
CancellationToken
is not enough, because the method calls under the hoodpublic virtual Task<ServiceBusReceivedMessage> ReceiveMessageAsync(TimeSpan? maxWaitTime = null, CancellationToken cancellationToken = default);
without passing anymaxWaitTime
.This means that even if we want to use the
CancellationToken
to wait at most 5 seconds for a message to not be received, it will actually wait 1 minute (the default value ofmaxWaitTime
).Our current workaround was to create an extension that takes the
maxWaitTime
parameter as well, however it would be nice to have this part of the SDK.This is our extension:
The text was updated successfully, but these errors were encountered: