Skip to content

Conversation

@xzxiaoshan
Copy link

方法updateClientBinlogFilenameAndPosition和updateGtidSet等方法一样,可以被按需重写。 例如,重写该方法并添加对 binlogFileName 和 position 进行持久化。当服务宕机重启后可以从持久化中读取并继续。

例如:

        BinaryLogClient client = new BinaryLogClient(binLogProperties.getHost(), binLogProperties.getPort(),
                binLogProperties.getUsername(), binLogProperties.getPassword()) {

            @Override
            private void updateClientBinlogFilenameAndPosition(Event event) {
                super.updateClientBinlogFilenameAndPosition(event);
                // 将binlogFileName和position持久化记录,在服务宕机重启后读取并继续
                // (略)
            }
        };

方法updateClientBinlogFilenameAndPosition和updateGtidSet等方法一样,可以被按需重写。
例如,重写该方法并添加对 binlogFileName 和 position 进行持久化。当服务宕机重启后可以从持久化中读取并继续。

例如:
```
        BinaryLogClient client = new BinaryLogClient(binLogProperties.getHost(), binLogProperties.getPort(),
                binLogProperties.getUsername(), binLogProperties.getPassword()) {

            @OverRide
            private void updateClientBinlogFilenameAndPosition(Event event) {
                super.updateClientBinlogFilenameAndPosition(event);
                // 将binlogFileName和position持久化记录,在服务宕机重启后读取并继续
                // (略)
            }
        };
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant