[FEATURE REQ] Cancellation support for client.ReceiveAsync()
See original GitHub issueIs your feature request related to a problem? Please describe.
Azure Service Bus is using long-polling to retrieve messages. That means user code has to wait for command execution before an endpoint can shut down. With asynchronous libraries, it’s a common theme and a recommended practice to pass a CancellationToken
to invoke earlier termination of work.
Describe the solution you’d like
- Add support for
CancellationToken
toReceiveAsync()
- Consider a review of the client to support cancellation pattern throughout various APIs (
ReceiveAsync()
,SendAsync()
,AcceptMessageSessionAsync()
, etc).
Describe alternatives you’ve considered
For the context, here’s the original issue from the client’s previous repository: https://github.com/Azure/azure-service-bus-dotnet/issues/439#issuecomment-423770087
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:13 (11 by maintainers)
Top Results From Across the Web
c# - How to to make UdpClient.ReceiveAsync() cancelable?
Unfortunately, SendAsync() of the UdpClient class does not accept a CancellationToken . So I started changing it to: public Task<bool> SendAsync ...
Read more >UdpClient.ReceiveAsync Method (System.Net.Sockets)
ReceiveAsync (CancellationToken) Returns a UDP datagram asynchronously that was sent by a remote host.
Read more >Code, code and more code.: May 2020 - Marc Gravell
Run(async () => { try { await foreach (var message in request.WithCancellation(allDone.Token)) { await transport.SendAsync(message, allDone.
Read more >Asynchronous programming - AWS SDK for Java 2.x
Synchronous methods block your thread's execution until the client receives a response from the service. Asynchronous methods return immediately, giving control ...
Read more >Async/Await - NetMQ - Read the Docs
NetMQRuntime.Run can accept multiple tasks and also a cancellation token. NetMQRuntime.Run runs until all tasks are completed or cancellation token has been ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@axisc closing public issues in favour of an internal backlog is not a good idea. Please keep public issues open and close when the internal issues are completed.
Thanks for your feedback. We will keep this issue open and will update it once we have any news about the candidate feature to implement token cancellation support.