EventStore / EventStoreDB-Client-Java

Official Asynchronous Java 8+ Client Library for EventStoreDB 20.6+
https://eventstore.com
Apache License 2.0
63 stars 20 forks source link

PersistentSubscriptionListener onCancelled should have additional parameter to pass a "Cause" #119

Closed TomMante closed 11 months ago

TomMante commented 2 years ago

I am currently working on persistent subscription, and I had an issue where when I was processing all the events in a persistent subscription, I had an exception while processing an event.

I am not receiving this exception, because the library is receiving a StatusRuntimeException with status "CANCELLED", but the cause of that StatusRuntimeException was my underlying exception (In my case it was a deserialization exception).

I was wondering, wouldn't it be better to add pass the "cause" of cancellation to the PersistentSubscriptionListener? this way, as the consumer can decide what to do with that. In my case I could throw an exception or log the cause of cancellation.

Right now If the persistent subscription has an exception, I am blind to the issue.

Could this be added?

The class I am talking about is: PersistentSubscriptionListener.java

Which is used by the SubscribePersistentSubscription.java

Thank you