Search in sources :

Example 1 with MemoryMetaManager

use of com.alibaba.otter.canal.meta.MemoryMetaManager in project canal by alibaba.

the class CanalInstanceWithManager method initMetaManager.

protected void initMetaManager() {
    logger.info("init metaManager begin...");
    MetaMode mode = parameters.getMetaMode();
    if (mode.isMemory()) {
        metaManager = new MemoryMetaManager();
    } else if (mode.isZookeeper()) {
        metaManager = new ZooKeeperMetaManager();
        ((ZooKeeperMetaManager) metaManager).setZkClientx(getZkclientx());
    } else if (mode.isMixed()) {
        // metaManager = new MixedMetaManager();
        // 换用优化过的mixed, at
        metaManager = new PeriodMixedMetaManager();
        // 2012-09-11
        // 设置内嵌的zk metaManager
        ZooKeeperMetaManager zooKeeperMetaManager = new ZooKeeperMetaManager();
        zooKeeperMetaManager.setZkClientx(getZkclientx());
        ((PeriodMixedMetaManager) metaManager).setZooKeeperMetaManager(zooKeeperMetaManager);
    } else {
        throw new CanalException("unsupport MetaMode for " + mode);
    }
    logger.info("init metaManager end! \n\t load CanalMetaManager:{} ", metaManager.getClass().getName());
}
Also used : MemoryMetaManager(com.alibaba.otter.canal.meta.MemoryMetaManager) MetaMode(com.alibaba.otter.canal.instance.manager.model.CanalParameter.MetaMode) PeriodMixedMetaManager(com.alibaba.otter.canal.meta.PeriodMixedMetaManager) ZooKeeperMetaManager(com.alibaba.otter.canal.meta.ZooKeeperMetaManager) CanalException(com.alibaba.otter.canal.common.CanalException)

Aggregations

CanalException (com.alibaba.otter.canal.common.CanalException)1 MetaMode (com.alibaba.otter.canal.instance.manager.model.CanalParameter.MetaMode)1 MemoryMetaManager (com.alibaba.otter.canal.meta.MemoryMetaManager)1 PeriodMixedMetaManager (com.alibaba.otter.canal.meta.PeriodMixedMetaManager)1 ZooKeeperMetaManager (com.alibaba.otter.canal.meta.ZooKeeperMetaManager)1