question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE REQ] - Completion and Complete on ServiceBusProcessor

See original GitHub issue

Library name

Azure.Messaging.ServiceBus

Please describe the feature.

I’m quite a big user of the TPL library because it served a lot of my issues and problematics. Is there any possibility to have any clue on what’s happening on the ServiceBusProcess instances ?

I mean, it’s possible to call “StopProcessingAsync” to stop receiving messages, but what happen if it still were messages processing asynchronously (MaxConcurrentCall > 1) ? When i try to gracefully shutdown my service, what i would do is :

  • Stop Processing (stop receiving messages)
  • Wait for processor messages that are still in progress in background
  • Dispose Processors resources

In TPL library, what you can do is simply :

actionBlock.Complete(); // Equivalent of StopProcessingAsync on ServiceBusProcessor
await actionBlock.Completion;

Found an issue, which seems linked to my request : https://github.com/Azure/azure-sdk-for-net/issues/21869

Is it embedded in the StopProcessingAsync ? The doc doesn’t mention anything about work in progress, i can only see “The method will cause the receivers to stop receiving” not “and finish its work in progress”.

Any thoughts ?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JoshLove-msftcommented, Jun 7, 2022

Is that possible to add a few words in the documentation to explain that in-flight processing messages are awaited too ?

Absolutely - I will submit a PR to improve the ref docs for these methods.

0reactions
Rayzbamcommented, Jun 7, 2022

Oh ok, that’s why i asked if it was “embedded” in the StopProcessingAsync. In my opinion documentation is not clear on that point and, i don’t know for other users, but you have to know that processing messages will be awaited too when you call this method.

Is that possible to add a few words in the documentation to explain that in-flight processing messages are awaited too ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ServiceBusProcessor Class (Azure.Messaging.ServiceBus)
Gets a value that indicates whether the processor should automatically complete messages after the message handler has completed processing.
Read more >
Does the ServiceBusProcessor completes messages ...
I tried specifying ReceiveMode = ServiceBusReceiveMode.PeekLock to no avail too. How do I enable explicit completion of messages? static ...
Read more >
Azure Service Bus client library for .NET
Using the Processor​​ It offers automatic completion of processed messages, automatic message lock renewal, and concurrent execution of user specified event ...
Read more >
Azure Service Bus and its Complete Overview
Microsoft Azure Service Bus. Acquire all necessary knowledge on Azure Service Bus in this definite guide. In a nutshell, it covers basic Service...
Read more >
Handle Azure Service Bus Messages Queue Using ...
By default, Service Bus message that has been processed in Azure Functions will be completed automatically and disappear from the Service Bus ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found