Search in sources :

Example 1 with SimpleNodeAccessStrategy

use of com.alibaba.otter.canal.client.impl.SimpleNodeAccessStrategy in project canal by alibaba.

the class CanalConnectors method newClusterConnector.

/**
 * 创建带cluster模式的客户端链接,自动完成failover切换
 *
 * @param addresses
 * @param destination
 * @param username
 * @param password
 * @return
 */
public static CanalConnector newClusterConnector(List<? extends SocketAddress> addresses, String destination, String username, String password) {
    ClusterCanalConnector canalConnector = new ClusterCanalConnector(username, password, destination, new SimpleNodeAccessStrategy(addresses));
    canalConnector.setSoTimeout(60 * 1000);
    canalConnector.setIdleTimeout(60 * 60 * 1000);
    return canalConnector;
}
Also used : SimpleNodeAccessStrategy(com.alibaba.otter.canal.client.impl.SimpleNodeAccessStrategy) ClusterCanalConnector(com.alibaba.otter.canal.client.impl.ClusterCanalConnector)

Aggregations

ClusterCanalConnector (com.alibaba.otter.canal.client.impl.ClusterCanalConnector)1 SimpleNodeAccessStrategy (com.alibaba.otter.canal.client.impl.SimpleNodeAccessStrategy)1