use of com.alibaba.otter.canal.parse.support.AuthenticationInfo in project otter by alibaba.
the class MediaHAController method start.
public void start() throws CanalHAException {
super.start();
if (this.supplier == null) {
validate();
this.supplier = MediaDatasourceSupplier.newInstance(group);
}
if (!this.supplier.isStart()) {
this.supplier.start();
}
DatasourceInfo fetched = this.supplier.fetchMaster();
AuthenticationInfo masterFetched = AuthenticationInfoUtils.createFrom(fetched);
log.info(String.format("medialHAController started for goup:[%s], and first auth info is : [%s]", this.group, masterFetched));
this.availableAuthenticationInfo = customInfoIfNecessay(masterFetched);
log.info(String.format("medialHAController customed for goup:[%s], and first auth info is : [%s]", this.group, this.availableAuthenticationInfo));
this.supplier.addSwtichCallback(new DatasourceChangeCallback() {
@Override
public void masterChanged(DatasourceInfo newMaster) {
AuthenticationInfo newAuthenticationInfo = AuthenticationInfoUtils.createFrom(newMaster);
switchEventSource(newAuthenticationInfo);
}
});
}
Aggregations