parent
efc039cf69
commit
8bc1198c9f
@ -0,0 +1,27 @@
|
||||
package com.dsideal.base.Test;
|
||||
|
||||
import com.github.shyiko.mysql.binlog.BinaryLogClient;
|
||||
import com.github.shyiko.mysql.binlog.event.Event;
|
||||
import com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//https://github.com/osheroff/mysql-binlog-connector-java
|
||||
public class TestBinLog {
|
||||
public static void main(String[] args) throws IOException {
|
||||
BinaryLogClient client = new BinaryLogClient("10.10.14.203", 3306, "root", "Password123@mysql");
|
||||
EventDeserializer eventDeserializer = new EventDeserializer();
|
||||
eventDeserializer.setCompatibilityMode(
|
||||
EventDeserializer.CompatibilityMode.DATE_AND_TIME_AS_LONG,
|
||||
EventDeserializer.CompatibilityMode.CHAR_AND_BINARY_AS_BYTE_ARRAY
|
||||
);
|
||||
client.setEventDeserializer(eventDeserializer);
|
||||
client.registerEventListener(new BinaryLogClient.EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
}
|
||||
});
|
||||
client.connect();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue