Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.25k stars 1.93k forks source link

Deprecation of Service Bus Processor Stop API #34464

Open anuchandy opened 1 year ago

anuchandy commented 1 year ago

Today Service Bus Processor exposes two APIs that complete the message pumping - stop and close.

The mainline use case is - the application wants the Processor to pump the message forever. When/If the application shuts down, it calls close API to dispose of the Processor.

As the engineering team recently reevaluated the past design choices, we identified that the stop API involves quite a complexity; supporting it correctly involves a reasonable (allocation, coordination) overhead and contributes to engineering costs. Additionally, the above mainline use case (that does not use stop) pays the price of this overhead.

The engineering team came to the conclusion that the mainline use case will greatly benefit from deprecating and removing stop , and saves engineering and maintenance costs.

Going forward, starting Processor that was stopped before is not recommended and this feature may be deprecated in future. Recommendation is to close the Processor instance and create a new one to restart processing.


The April 2023 version (v7.13.4) of Service Bus SDK includes a log message in the warning level to communicate this upcoming change; this is the pr.

trefsahl commented 1 year ago

We run a async "short-lived" client for receving messages and has tested recreating clients with the use of close(). But this does not behave in a gracefull way today. This is a list of my top values from the logs when we call close() after a few days in production with version 7.13.4 of the java lib (I guess some of the messages could be ignored, but still...)

Maybe a combination of first calling stop(), and the close() a short while later could be good choice?