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.35k stars 1.99k forks source link

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

Closed 1goldenboy closed 4 weeks ago

1goldenboy commented 1 month 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 1 month ago

@anuchandy @conniey @lmolkova

github-actions[bot] commented 1 month ago

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

1goldenboy commented 4 weeks ago

This has already been resolved it seems. I was mistakenly looking at an api running an older version. Sorry for the inconvenience https://github.com/Azure/azure-sdk-for-java/commit/c2f6e5ca010a561a20b7a2ccbfe98b94545ae3b1