azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[QUERY] Service Bus Processor Graceful Shutdown

Open rileymichael opened this issue 6 months ago • 2 comments

Query/Question What is the intended way to drain a service bus processor in order to shutdown gracefully? We've attempted to call ServiceBusProcessorClient#stop -> wait a period of time -> call ServiceBusProcessorClient#close to allow for (most) in-flight messages to finish processing but it looks like the underlying receiver is disposed (even though the javadoc indicates the receiving links remain open?).

Here's the exception when a processor attempts to update the status after stop is called:

java.lang.IllegalStateException: Cannot perform operation 'abandoned' on a disposed receiver.
	at com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient.updateDisposition(ServiceBusReceiverAsyncClient.java:1528)
	at com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient.abandon(ServiceBusReceiverAsyncClient.java:509)
	at com.azure.messaging.servicebus.ServiceBusReceivedMessageContext.abandon(ServiceBusReceivedMessageContext.java:79)

related comment: https://github.com/Azure/azure-sdk-for-java/issues/34464#issuecomment-2315331178

Why is this not a Bug or a feature Request? Unclear if this is a gap or intentionally unsupported (see related issue above)

Setup (please complete the following information if applicable):

  • Library/Libraries: com.azure:azure-messaging-servicebus:7.17.8

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [X] Query Added
  • [X] Setup information Added

rileymichael avatar Jun 16 '25 21:06 rileymichael

@anuchandy @conniey @lmolkova

github-actions[bot] avatar Jun 16 '25 21:06 github-actions[bot]

Thank you for your feedback. Tagging and routing to the team member best able to assist.

github-actions[bot] avatar Jun 16 '25 21:06 github-actions[bot]

If anyone in the Azure team can point out y'all's take on this, I would gladly put in some time to make a pull request to resolve the issue. However, I don't want to risk the PR getting ignored and my time thereby being wasted - see the original issue where the Azure team provided no information and closed out the work as not planned.

This is a serious problem that prevents Service Bus from being treated as a mature solution in Java workspaces.

MT-Jacobs avatar Aug 28 '25 16:08 MT-Jacobs

@EldertGrootenboer Could you take a look and help with this issue?

samvaity avatar Nov 13 '25 23:11 samvaity