Search in sources :

Example 1 with ESConfigMonitor

use of com.alibaba.otter.canal.client.adapter.es.core.monitor.ESConfigMonitor in project canal by alibaba.

the class ESAdapter method init.

@Override
public void init(OuterAdapterConfig configuration, Properties envProperties) {
    try {
        this.envProperties = envProperties;
        Map<String, ESSyncConfig> esSyncConfigTmp = ESSyncConfigLoader.load(envProperties);
        // 过滤不匹配的key的配置
        esSyncConfigTmp.forEach((key, config) -> {
            if ((config.getOuterAdapterKey() == null && configuration.getKey() == null) || (config.getOuterAdapterKey() != null && config.getOuterAdapterKey().equalsIgnoreCase(configuration.getKey()))) {
                esSyncConfig.put(key, config);
            }
        });
        for (Map.Entry<String, ESSyncConfig> entry : esSyncConfig.entrySet()) {
            String configName = entry.getKey();
            ESSyncConfig config = entry.getValue();
            addSyncConfigToCache(configName, config);
        }
        esSyncService = new ESSyncService(esTemplate);
        esConfigMonitor = new ESConfigMonitor();
        esConfigMonitor.init(this, envProperties);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : ESSyncService(com.alibaba.otter.canal.client.adapter.es.core.service.ESSyncService) ESConfigMonitor(com.alibaba.otter.canal.client.adapter.es.core.monitor.ESConfigMonitor) ESSyncConfig(com.alibaba.otter.canal.client.adapter.es.core.config.ESSyncConfig) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map)

Aggregations

ESSyncConfig (com.alibaba.otter.canal.client.adapter.es.core.config.ESSyncConfig)1 ESConfigMonitor (com.alibaba.otter.canal.client.adapter.es.core.monitor.ESConfigMonitor)1 ESSyncService (com.alibaba.otter.canal.client.adapter.es.core.service.ESSyncService)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1