-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EventHandlerV2 support handle event with replication.EventHeader #740
Conversation
Maybe we should change an |
change EventHandlerV2 name to another like EventHandlerWithHeader or change the method in EventHandler ? |
Oh i forget that for major version updates we can break compatibility. I agree with this.
It means we can change the API interface while keeping the old name EventHandler. But because this chance is rare, we might ask other developers what they want to change and do them at once |
canal/handler.go
Outdated
@@ -40,3 +40,24 @@ func (h *DummyEventHandler) String() string { return "DummyEventHandler" } | |||
func (c *Canal) SetEventHandler(h EventHandler) { | |||
c.eventHandler = h | |||
} | |||
|
|||
// EventHandlerV2 can process event with replication.EventHeader | |||
type EventHandlerV2 interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for my previous comments, now I think we can change the old EventHandler
to this interface (will review more carefully later)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget this comment @BLAZZ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed EventHandlerV2 to EventHandler
please fix CI, some test files need to be updated |
add EventHandlerV2 to get timestamp from event, so that canal can show the how much time delay when process like
it can show on UI like
binlog file: mysql-bin.000102
binlog position: 1142900
binlog timestamp: 2022-11-25 15:54:07 (1669362847)
tiem delay: 2 sec