com.hazelcast.config.Config.addWanReplicationConfig()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中com.hazelcast.config.Config.addWanReplicationConfig()方法的一些代码示例,展示了Config.addWanReplicationConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.addWanReplicationConfig()方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:addWanReplicationConfig

Config.addWanReplicationConfig介绍

[英]Adds the WAN replication config under the name defined by WanReplicationConfig#getName().
[中]在WanReplicationConfig#getName()定义的名称下添加WAN复制配置。

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public Config addWanReplicationConfig(WanReplicationConfig wanReplicationConfig) {
  return staticConfig.addWanReplicationConfig(wanReplicationConfig);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public Config addWanReplicationConfig(WanReplicationConfig wanReplicationConfig) {
  return staticConfig.addWanReplicationConfig(wanReplicationConfig);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public Config addWanReplicationConfig(WanReplicationConfig wanReplicationConfig) {
  return super.addWanReplicationConfig(wanReplicationConfig);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public Config addWanReplicationConfig(WanReplicationConfig wanReplicationConfig) {
  return super.addWanReplicationConfig(wanReplicationConfig);
}

代码示例来源:origin: hazelcast/hazelcast-jet

private void handleWanReplication(Node node) {
  Node attName = node.getAttributes().getNamedItem("name");
  String name = getTextContent(attName);
  WanReplicationConfig wanReplicationConfig = new WanReplicationConfig();
  wanReplicationConfig.setName(name);
  for (Node nodeTarget : childElements(node)) {
    String nodeName = cleanNodeName(nodeTarget);
    if ("wan-publisher".equals(nodeName)) {
      WanPublisherConfig publisherConfig = new WanPublisherConfig();
      publisherConfig.setGroupName(getAttribute(nodeTarget, "group-name"));
      publisherConfig.setPublisherId(getAttribute(nodeTarget, "publisher-id"));
      for (Node targetChild : childElements(nodeTarget)) {
        handleWanPublisherConfig(publisherConfig, targetChild);
      }
      wanReplicationConfig.addWanPublisherConfig(publisherConfig);
    } else if ("wan-consumer".equals(nodeName)) {
      WanConsumerConfig consumerConfig = new WanConsumerConfig();
      for (Node targetChild : childElements(nodeTarget)) {
        handleWanConsumerConfig(consumerConfig, targetChild);
      }
      wanReplicationConfig.setWanConsumerConfig(consumerConfig);
    }
  }
  config.addWanReplicationConfig(wanReplicationConfig);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private void handleWanReplication(Node node) {
  Node attName = node.getAttributes().getNamedItem("name");
  String name = getTextContent(attName);
  WanReplicationConfig wanReplicationConfig = new WanReplicationConfig();
  wanReplicationConfig.setName(name);
  for (Node nodeTarget : childElements(node)) {
    String nodeName = cleanNodeName(nodeTarget);
    if ("wan-publisher".equals(nodeName)) {
      WanPublisherConfig publisherConfig = new WanPublisherConfig();
      publisherConfig.setGroupName(getAttribute(nodeTarget, "group-name"));
      publisherConfig.setPublisherId(getAttribute(nodeTarget, "publisher-id"));
      for (Node targetChild : childElements(nodeTarget)) {
        handleWanPublisherConfig(publisherConfig, targetChild);
      }
      wanReplicationConfig.addWanPublisherConfig(publisherConfig);
    } else if ("wan-consumer".equals(nodeName)) {
      WanConsumerConfig consumerConfig = new WanConsumerConfig();
      for (Node targetChild : childElements(nodeTarget)) {
        handleWanConsumerConfig(consumerConfig, targetChild);
      }
      wanReplicationConfig.setWanConsumerConfig(consumerConfig);
    }
  }
  config.addWanReplicationConfig(wanReplicationConfig);
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

private Config getConfigClusterA() {
  Config config = new Config();
  config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
  config.getGroupConfig().setName("clusterA").setPassword("clusterA-pass");
  config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
  config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5701");
  config.setInstanceName("clusterA");
  config.getNetworkConfig().setPort(5701);
  config.setClassLoader(createCacheManagerClassLoader());
  WanReplicationConfig wanReplicationConfig = new WanReplicationConfig();
  wanReplicationConfig.setName("AtoB");
  WanPublisherConfig publisherConfigClusterB = new WanPublisherConfig();
  publisherConfigClusterB.setClassName(WanBatchReplication.class.getName());
  publisherConfigClusterB.setGroupName("clusterB");
  Map<String, Comparable> props = publisherConfigClusterB.getProperties();
  props.put(WanReplicationProperties.ENDPOINTS.key(), "127.0.0.1:5702");
  props.put(WanReplicationProperties.GROUP_PASSWORD.key(), "clusterB-pass");
  // setting acknowledge type is optional, defaults to ACK_ON_OPERATION_COMPLETE
  props.put(WanReplicationProperties.ACK_TYPE.key(), WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE.name());
  wanReplicationConfig.addWanPublisherConfig(publisherConfigClusterB);
  config.addWanReplicationConfig(wanReplicationConfig);
  WanReplicationRef wanReplicationRef = new WanReplicationRef();
  wanReplicationRef.setName("AtoB");
  config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
  wanReplicationRef.setMergePolicy(HigherHitsCacheMergePolicy.class.getName());
  wanReplicationRef.addFilter(SampleCacheWanEventFilter.class.getName());
  config.getCacheConfig("default").setWanReplicationRef(wanReplicationRef);
  return config;
}

相关文章

Config类方法