Search in sources :

Example 6 with AuthenticationInfo

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);
        }
    });
}
Also used : DatasourceInfo(com.alibaba.otter.common.push.supplier.DatasourceInfo) DatasourceChangeCallback(com.alibaba.otter.common.push.supplier.DatasourceChangeCallback) AuthenticationInfo(com.alibaba.otter.canal.parse.support.AuthenticationInfo)

Aggregations

AuthenticationInfo (com.alibaba.otter.canal.parse.support.AuthenticationInfo)6 EntryPosition (com.alibaba.otter.canal.protocol.position.EntryPosition)3 CanalException (com.alibaba.otter.canal.common.CanalException)2 CanalEventParser (com.alibaba.otter.canal.parse.CanalEventParser)2 CanalHAController (com.alibaba.otter.canal.parse.ha.CanalHAController)2 MysqlEventParser (com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser)2 AbstractCanalEventSinkTest (com.alibaba.otter.canal.parse.stub.AbstractCanalEventSinkTest)2 AbstractCanalLogPositionManager (com.alibaba.otter.canal.parse.stub.AbstractCanalLogPositionManager)2 Entry (com.alibaba.otter.canal.protocol.CanalEntry.Entry)2 EventType (com.alibaba.otter.canal.protocol.CanalEntry.EventType)2 RowChange (com.alibaba.otter.canal.protocol.CanalEntry.RowChange)2 RowData (com.alibaba.otter.canal.protocol.CanalEntry.RowData)2 LogPosition (com.alibaba.otter.canal.protocol.position.LogPosition)2 CanalSinkException (com.alibaba.otter.canal.sink.exception.CanalSinkException)2 InetSocketAddress (java.net.InetSocketAddress)2 List (java.util.List)2 Test (org.junit.Test)2 MediaHAController (com.alibaba.otter.canal.extend.ha.MediaHAController)1 AviaterRegexFilter (com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter)1 CanalInstance (com.alibaba.otter.canal.instance.core.CanalInstance)1