twingly / ecco

:dolphin: MySQL replication binlog parser in JRuby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Capability to attach multiple "on_*" handlers

walro opened this issue · comments

I think that the current behavior is that the last setup on_* would "win".

For one it would make testing so much easier. See 56927d9#commitcomment-14448933 for some context.

Another way (as we just discussed IRL) could be exposing @client.register_event_listener to the user, then the user could register an arbitrary number of handlers.

That is what mysql-binlog-connector does in its test: https://github.com/shyiko/mysql-binlog-connector-java/blob/0.2.4/src/test/java/com/github/shyiko/mysql/binlog/BinaryLogClientTest.java#L32-L44

We would need to expose SaveEventListener and RowEventListener so the user could use them as handlers, if the user thinks they are suitable.

There was some back and forth about multiple listeners in shyiko/mysql-binlog-connector-java#15