Skip to content

Commit 06d8851

Browse files
Merge pull request #9 from fivetran/rebase-move-connect-hook-onto-84-updates
Merge beforeConnect hook into main
2 parents 26685a4 + 47b32e9 commit 06d8851

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/com/github/shyiko/mysql/binlog/BinaryLogClient.java

+13
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,11 @@ public void connect() throws IOException, IllegalStateException {
603603
channel.authenticationComplete();
604604

605605
connectionId = greetingPacket.getThreadId();
606+
607+
for (LifecycleListener lifecycleListener : lifecycleListeners) {
608+
lifecycleListener.beforeConnect(this);
609+
}
610+
606611
if ("".equals(binlogFilename)) {
607612
setupGtidSet();
608613
}
@@ -618,6 +623,7 @@ public void connect() throws IOException, IllegalStateException {
618623
setupConnection();
619624
gtid = null;
620625
tx = false;
626+
621627
requestBinaryLogStream();
622628
} catch (IOException e) {
623629
disconnectChannel();
@@ -1404,6 +1410,13 @@ public interface EventListener {
14041410
* {@link BinaryLogClient}'s lifecycle listener.
14051411
*/
14061412
public interface LifecycleListener {
1413+
/**
1414+
* Called once client has successfully logged in but before requested binlog events.
1415+
* @param client the client that logged in
1416+
*/
1417+
default void beforeConnect(BinaryLogClient client) {
1418+
client.logger.info("No pre-streaming activity configured");
1419+
}
14071420

14081421
/**
14091422
* Called once client has successfully logged in but before started to receive binlog events.

0 commit comments

Comments
 (0)