本文整理了Java中com.github.shyiko.mysql.binlog.BinaryLogClient.<init>()
方法的一些代码示例,展示了BinaryLogClient.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BinaryLogClient.<init>()
方法的具体详情如下:
包路径:com.github.shyiko.mysql.binlog.BinaryLogClient
类名称:BinaryLogClient
方法名:<init>
[英]Alias for BinaryLogClient(hostname, port, <no schema> = null, username, password).
[中]BinaryLogClient的别名(主机名、端口、<no schema>=null、用户名、密码)。
代码示例来源:origin: apache/nifi
BinaryLogClient createBinlogClient(String hostname, int port, String username, String password) {
return new BinaryLogClient(hostname, port, username, password);
}
代码示例来源:origin: apache/rocketmq-externals
public void start() throws Exception {
initDataSource();
binlogPositionManager = new BinlogPositionManager(config, dataSource);
binlogPositionManager.initBeginPosition();
schema = new Schema(dataSource);
schema.load();
eventListener = new EventListener(queue);
binaryLogClient = new BinaryLogClient(config.mysqlAddr,
config.mysqlPort,
config.mysqlUsername,
config.mysqlPassword);
binaryLogClient.setBlocking(true);
binaryLogClient.setServerId(1001);
EventDeserializer eventDeserializer = new EventDeserializer();
eventDeserializer.setCompatibilityMode(EventDeserializer.CompatibilityMode.DATE_AND_TIME_AS_LONG,
EventDeserializer.CompatibilityMode.CHAR_AND_BINARY_AS_BYTE_ARRAY);
binaryLogClient.setEventDeserializer(eventDeserializer);
binaryLogClient.registerEventListener(eventListener);
binaryLogClient.setBinlogFilename(binlogPositionManager.getBinlogFilename());
binaryLogClient.setBinlogPosition(binlogPositionManager.getPosition());
binaryLogClient.connect(3000);
LOGGER.info("Started.");
doProcess();
}
代码示例来源:origin: zendesk/maxwell
this.client = new BinaryLogClient(mysqlConfig.host, mysqlConfig.port, mysqlConfig.user, mysqlConfig.password);
代码示例来源:origin: debezium/debezium
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();
}
代码示例来源:origin: debezium/debezium
client = new BinaryLogClient(connectionContext.hostname(), connectionContext.port(), connectionContext.username(), connectionContext.password());
代码示例来源:origin: org.apache.nifi/nifi-cdc-mysql-processors
BinaryLogClient createBinlogClient(String hostname, int port, String username, String password) {
return new BinaryLogClient(hostname, port, username, password);
}
代码示例来源:origin: mysql-time-machine/replicator
private BinaryLogClient getClient(String hostname) {
// TODO: Implement status variable parser: https://github.com/shyiko/mysql-binlog-connector-java/issues/174
BinaryLogClient client = new BinaryLogClient(
hostname,
this.port,
this.schema,
this.username,
this.password
);
EventDeserializer eventDeserializer = new EventDeserializer();
eventDeserializer.setCompatibilityMode(EventDeserializer.CompatibilityMode.CHAR_AND_BINARY_AS_BYTE_ARRAY);
client.setEventDeserializer(eventDeserializer);
return client;
}
代码示例来源:origin: perfectsense/dari
username = ObjectUtils.firstNonNull(username, "");
password = ObjectUtils.firstNonNull(password, "");
this.client = new BinaryLogClient(host, port, catalog, username, password);
this.lifecycleListener = new MySQLBinaryLogLifecycleListener(cache);
代码示例来源:origin: perfectsense/dari
this.client = new BinaryLogClient(host, port != null ? port : 3306, schema, username, password);
this.lifecycleListener = new MySQLBinaryLogLifecycleListener(cache);
代码示例来源:origin: networknt/light-eventuate-4j
public void start(Optional<BinlogFileOffset> binlogFileOffset, Consumer<M> eventConsumer) throws IOException, TimeoutException {
client = new BinaryLogClient(host, port, dbUserName, dbPassword);
client.setServerId(binlogClientUniqueId);
client.setKeepAliveInterval(10 * 1000);
代码示例来源:origin: eventuate-local/eventuate-local
public void start(Optional<BinlogFileOffset> binlogFileOffset, Consumer<M> eventConsumer) {
client = new BinaryLogClient(host, port, dbUserName, dbPassword);
client.setServerId(binlogClientUniqueId);
client.setKeepAliveInterval(5 * 1000);
代码示例来源:origin: io.debezium/debezium-connector-mysql
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();
}
内容来源于网络,如有侵权,请联系作者删除!