this.client.setKeepAlive(false);
client.setServerId(serverId); client.setSSLMode(sslModeFor(connectionContext.sslMode())); client.setKeepAlive(context.config().getBoolean(MySqlConnectorConfig.KEEP_ALIVE)); client.setKeepAliveInterval(context.config().getLong(MySqlConnectorConfig.KEEP_ALIVE_INTERVAL_MS)); client.registerEventListener(context.bufferSizeForBinlogReader() == 0
protected void startClient(Consumer<BinaryLogClient> preConnect) throws IOException, TimeoutException, SQLException { // Connect the bin log client ... counters = new EventQueue(DEFAULT_TIMEOUT, this::logConsumedEvent, this::logIgnoredEvent); client = new BinaryLogClient(config.getHostname(), config.getPort(), "replicator", "replpass"); client.setServerId(client.getServerId() - 1); // avoid clashes between BinaryLogClient instances client.setKeepAlive(false); client.setSSLMode(SSLMode.DISABLED); client.registerEventListener(counters); client.registerEventListener(this::recordEvent); client.registerLifecycleListener(new TraceLifecycleListener()); EventDeserializer eventDeserializer = new EventDeserializer(); eventDeserializer.setEventDataDeserializer(EventType.STOP, new StopEventDataDeserializer()); client.setEventDeserializer(eventDeserializer); if (preConnect != null) preConnect.accept(client); client.connect(DEFAULT_TIMEOUT); // does not block // Set up the table as one transaction and wait to see the events ... conn.execute("DROP TABLE IF EXISTS person", "CREATE TABLE person (" + " name VARCHAR(255) primary key," + " age INTEGER NULL DEFAULT 10," + " createdAt DATETIME NULL DEFAULT CURRENT_TIMESTAMP," + " updatedAt DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" + ")"); counters.consume(2, EventType.QUERY); counters.reset(); }
protected void startClient(Consumer<BinaryLogClient> preConnect) throws IOException, TimeoutException, SQLException { // Connect the bin log client ... counters = new EventQueue(DEFAULT_TIMEOUT, this::logConsumedEvent, this::logIgnoredEvent); client = new BinaryLogClient(config.getHostname(), config.getPort(), "replicator", "replpass"); client.setServerId(client.getServerId() - 1); // avoid clashes between BinaryLogClient instances client.setKeepAlive(false); client.setSSLMode(SSLMode.DISABLED); client.registerEventListener(counters); client.registerEventListener(this::recordEvent); client.registerLifecycleListener(new TraceLifecycleListener()); EventDeserializer eventDeserializer = new EventDeserializer(); eventDeserializer.setEventDataDeserializer(EventType.STOP, new StopEventDataDeserializer()); client.setEventDeserializer(eventDeserializer); if (preConnect != null) preConnect.accept(client); client.connect(DEFAULT_TIMEOUT); // does not block // Set up the table as one transaction and wait to see the events ... conn.execute("DROP TABLE IF EXISTS person", "CREATE TABLE person (" + " name VARCHAR(255) primary key," + " age INTEGER NULL DEFAULT 10," + " createdAt DATETIME NULL DEFAULT CURRENT_TIMESTAMP," + " updatedAt DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" + ")"); counters.consume(2, EventType.QUERY); counters.reset(); }