-
Notifications
You must be signed in to change notification settings - Fork 840
Open
Milestone
Description
I'm attempting to use the library for a project at my job, and I'm running into a problem because the BinaryLogClient will continue dispatching events to every EventListener, even if one (or all) of the listeners throws an exception on a previous event.
I have a proposed refactoring in order to make failure handling more flexible. The core ideas (ignoring backward compatibility for a moment, and imagining an ideal world) are:
BinaryLogClientshould only have oneEventListenerand oneLifecycleListener.- When the one
EventListenerthrows an exception, theBinaryLogClientshould abort and disconnect immediately. - The multiple listener behavior in the current library should be factored out into a
BroadcastEventListener(and aBroadcastLifecycleListener) that handles the registration/unregistration logic, dispatches to the registered listeners, and "swallows" the child listeners' exceptions if desired (the same behavior as the current code).
I have started a fork exploring these ideas (sacundim@8edbda1). In order not to break existing code that uses the library, I've modified the ideas described above in this way:
BinaryLogClientshould continue to behave exactly the same way as it does now.- I've added a class
AbstractBinaryLogClientand moved most of the original logic there.
I still have three issues I'd like to work through, though:
- My changes so far still break compatibility with existing code, because
BinaryLogClient.LifecycleListenerhas methods that take aBinaryLogClientargument. In my modified code as of now, this needs to be changed toAbstractBinaryLogClient, which means that existingLifecycleListenerimplementations will no longer compile. - I'm still generally just not certain that I have the best factoring.
- I haven't run any tests yet.
I'd appreciate to have your input into this matter.
Metadata
Metadata
Assignees
Labels
No labels