zongji
zongji copied to clipboard
add `subscribePosition` to options and use mysql.format
add a way to subscribe current binlog position
Thanks for your PR, can you add some tests for this feature ?
Yes, I have just add a test case for this feature, plz have a look.
This PR is adding a new feature without explicitly stating the bug that necessitated it. In the current implementation, if a binlog event occurs that is filtered, (due to not being in the includeEvents
option) there is no update to the binlogName
and binlogNextPos
property values.
This approach of adding another option introduces too much code to solve the problem. Instead, make those existing properties update before the filtering occurs:
if(event === undefined || event._filtered === true) return;
And then just always emit a position
event, even for filtered events. The binlog_
prefix is unneeded here. Since the position and filename values are properties of the ZongJi instance object, passing these values as another object on every position update is unnecessary bloat. I recommend having no arguments for this position
event. Event handlers may reference the values on the ZongJi instance.
@numtel thanks for your comments, I'll check my code more carefully.