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.33k stars 1.97k forks source link

[FEATURE REQ] More useful exception logging when user-exceptions occurs i processEvent callback in EventProcessorClient #42082

Open 1goldenboy opened 2 weeks ago

1goldenboy commented 2 weeks ago

Is your feature request related to a problem? Please describe. Currently [artifactId=azure-messaging-eventhubs, groupId=com.azure, version=5.18.7] when an exception is thrown in com.azure.messaging.eventhubs.implementation.PartitionProcessor#processEvent, there will be logged 4 exceptions. These are Error in event processing callback(x3) and Scheduler worker in group main failed with an uncaught exception.
Only the latter of these provide useful stacktrace for debugging, but the message itself isnt too helpful.

Describe the solution you'd like I would like to have the amount of logged exceptions reduced to one and for that particular exception to provide a more useful error message.

To reduce the amount of exceptions logged I do believe that a solution is to only wrap and not log the caught exception in com.azure.messaging.eventhubs.PartitionPumpManager#processEvent. The same goes for com.azure.messaging.eventhubs.PartitionPumpManager#processEvents.

To provide a more useful error message I think the reactive chain in com.azure.messaging.eventhubs.PartitionPumpManager#startPartitionPump need to handle exceptions being thrown in the .subscribe callbacks. I believe the most straight forward way is to wrap the processEvents method in a try catch and handle the exception with the same logic as in the outer catch clause in com.azure.messaging.eventhubs.PartitionPumpManager#startPartitionPump.

Describe alternatives you've considered Just ignore the duplicate errors

Information Checklist

github-actions[bot] commented 2 weeks ago

@anuchandy @conniey @lmolkova

github-actions[bot] commented 2 weeks ago

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