本文整理汇总了Java中com.github.shyiko.mysql.binlog.BinaryLogClient.setBinlogFilename方法的典型用法代码示例。如果您正苦于以下问题:Java BinaryLogClient.setBinlogFilename方法的具体用法?Java BinaryLogClient.setBinlogFilename怎么用?Java BinaryLogClient.setBinlogFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.shyiko.mysql.binlog.BinaryLogClient
的用法示例。
在下文中一共展示了BinaryLogClient.setBinlogFilename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BinlogClientImpl
import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入方法依赖的package包/类
public BinlogClientImpl(Vertx vertx, BinlogClientOptions options) {
this.vertx = vertx;
this.context = vertx.getOrCreateContext();
this.host = options.getHost();
this.port = options.getPort();
this.connectTimeout = options.getConnectTimeout();
this.sqlClient = MySQLClient.createNonShared(vertx,
new JsonObject()
.put("host", options.getHost())
.put("port", options.getPort())
.put("database", "information_schema")
.put("maxPoolSize", 1)
.put("username", options.getUsername())
.put("password",
"".equals(options.getPassword()) ?
null : options.getPassword())
);
dispatcher = new EventDispatcher(vertx,
new SchemaResolver(sqlClient));
client = new BinaryLogClient(
host, port,
options.getUsername(),
Optional.ofNullable(
options.getPassword()
).orElse("")
);
if (options.getFilename() != null) {
client.setBinlogFilename(options.getFilename());
}
if (options.getPosition() != -1) {
client.setBinlogPosition(options.getPosition());
}
client.setHeartbeatInterval(options.getHeartbeatInterval());
client.setKeepAlive(options.isKeepAlive());
client.setKeepAliveInterval(options.getKeepAliveInterval());
client.registerEventListener(this::handle);
}
示例2: run
import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入方法依赖的package包/类
@Override
public void run() {
client = new BinaryLogClient(host, port, user, password);
// TODO: GTID support
client.setBinlogFilename(position.getFilename());
client.setBinlogPosition(position.getOffset());
client.registerEventListener(this);
try {
client.connect();
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}
示例3: getBinlogEventParserProvider
import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入方法依赖的package包/类
public static Object getBinlogEventParserProvider(
int serverId,
int BINLOG_EVENT_PARSER_PROVIDER_CODE,
Configuration configuration,
PipelinePosition pipelinePosition) throws Exception {
if (BINLOG_EVENT_PARSER_PROVIDER_CODE == BinlogEventParserProviderCode.OR ) {
OpenReplicator openReplicator = new OpenReplicator();
// config
openReplicator.setUser(configuration.getReplicantDBUserName());
openReplicator.setPassword(configuration.getReplicantDBPassword());
openReplicator.setPort(configuration.getReplicantPort());
// host pool
openReplicator.setHost(pipelinePosition.getCurrentReplicantHostName());
openReplicator.setServerId(serverId);
// position
openReplicator.setBinlogPosition(pipelinePosition.getCurrentPosition().getBinlogPosition());
openReplicator.setBinlogFileName(pipelinePosition.getCurrentPosition().getBinlogFilename());
// disable lv2 buffer
openReplicator.setLevel2BufferSize(-1);
return openReplicator;
}
else if (BINLOG_EVENT_PARSER_PROVIDER_CODE == BinlogEventParserProviderCode.SHYIKO) {
BinaryLogClient client = new BinaryLogClient(
pipelinePosition.getCurrentReplicantHostName(),
configuration.getReplicantPort(),
configuration.getReplicantDBUserName(),
configuration.getReplicantDBPassword()
);
client.setServerId(serverId);
client.setBinlogPosition(pipelinePosition.getCurrentPosition().getBinlogPosition());
client.setBinlogFilename(pipelinePosition.getCurrentPosition().getBinlogFilename());
return client;
}
else {
throw new Exception("Unsupported parser exception");
}
}
示例4: positionClient
import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入方法依赖的package包/类
@Override
public void positionClient(BinaryLogClient client) {
client.setBinlogFilename(filename);
client.setBinlogPosition(position);
}