use of com.hazelcast.config.WanBatchPublisherConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testWanConfig.
// WAN REPLICATION
@Test
public void testWanConfig() {
@SuppressWarnings("rawtypes") HashMap<String, Comparable> props = new HashMap<>();
props.put("prop1", "val1");
props.put("prop2", "val2");
props.put("prop3", "val3");
WanReplicationConfig wanReplicationConfig = new WanReplicationConfig().setName("testName").setConsumerConfig(new WanConsumerConfig().setClassName("dummyClass").setProperties(props));
WanBatchPublisherConfig batchPublisher = new WanBatchPublisherConfig().setClusterName("dummyGroup").setPublisherId("dummyPublisherId").setSnapshotEnabled(false).setInitialPublisherState(WanPublisherState.STOPPED).setQueueCapacity(1000).setBatchSize(500).setBatchMaxDelayMillis(1000).setResponseTimeoutMillis(60000).setQueueFullBehavior(WanQueueFullBehavior.DISCARD_AFTER_MUTATION).setAcknowledgeType(WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE).setDiscoveryPeriodSeconds(20).setMaxTargetEndpoints(100).setMaxConcurrentInvocations(500).setUseEndpointPrivateAddress(true).setIdleMinParkNs(100).setIdleMaxParkNs(1000).setTargetEndpoints("a,b,c,d").setAwsConfig(getDummyAwsConfig()).setDiscoveryConfig(getDummyDiscoveryConfig()).setEndpoint("WAN").setProperties(props);
batchPublisher.getSyncConfig().setConsistencyCheckStrategy(ConsistencyCheckStrategy.MERKLE_TREES);
WanCustomPublisherConfig customPublisher = new WanCustomPublisherConfig().setPublisherId("dummyPublisherId").setClassName("className").setProperties(props);
WanConsumerConfig wanConsumerConfig = new WanConsumerConfig().setClassName("dummyClass").setProperties(props).setPersistWanReplicatedData(false);
wanReplicationConfig.setConsumerConfig(wanConsumerConfig).addBatchReplicationPublisherConfig(batchPublisher).addCustomPublisherConfig(customPublisher);
Config config = new Config().addWanReplicationConfig(wanReplicationConfig);
Config decConfig = getNewConfigViaGenerator(config);
ConfigCompatibilityChecker.checkWanConfigs(config.getWanReplicationConfigs(), decConfig.getWanReplicationConfigs());
}
use of com.hazelcast.config.WanBatchPublisherConfig in project hazelcast by hazelcast.
the class WanBatchPublisherConfigDTOTest method testSerialization.
@Test
public void testSerialization() {
Map<String, Comparable> properties = new HashMap<>();
properties.put("key1", "value1");
properties.put("key2", "value2");
WanBatchPublisherConfig expected = new WanBatchPublisherConfig().setClusterName("myClusterName").setPublisherId("myPublisherId").setSnapshotEnabled(true).setInitialPublisherState(WanPublisherState.STOPPED).setQueueCapacity(23).setBatchSize(500).setBatchMaxDelayMillis(1000).setResponseTimeoutMillis(60000).setQueueFullBehavior(WanQueueFullBehavior.THROW_EXCEPTION).setAcknowledgeType(WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE).setDiscoveryPeriodSeconds(20).setMaxTargetEndpoints(100).setMaxConcurrentInvocations(500).setUseEndpointPrivateAddress(true).setIdleMinParkNs(100).setIdleMaxParkNs(1000).setTargetEndpoints("a,b,c,d").setDiscoveryConfig(new DiscoveryConfig()).setSyncConfig(new WanSyncConfig()).setAwsConfig(new AwsConfig().setEnabled(true).setProperty("connection-timeout-seconds", "20")).setGcpConfig(new GcpConfig().setEnabled(true).setProperty("gcp", "gcp-val")).setAzureConfig(new AzureConfig().setEnabled(true).setProperty("azure", "azure-val")).setKubernetesConfig(new KubernetesConfig().setEnabled(true).setProperty("kubernetes", "kubernetes-val")).setEurekaConfig(new EurekaConfig().setEnabled(true).setProperty("eureka", "eureka-val")).setEndpoint("WAN").setProperties(properties);
WanBatchPublisherConfig actual = cloneThroughJson(expected);
assertTrue("Expected: " + expected + ", got:" + actual, WAN_PUBLISHER_CONFIG_CHECKER.check(expected, actual));
}
use of com.hazelcast.config.WanBatchPublisherConfig in project hazelcast by hazelcast.
the class WanReplicationConfigDTOTest method testSerialization.
@Test
public void testSerialization() {
WanReplicationConfig expected = new WanReplicationConfig().setName("myName").setConsumerConfig(new WanConsumerConfig()).addBatchReplicationPublisherConfig(new WanBatchPublisherConfig().setClusterName("group1")).addCustomPublisherConfig(new WanCustomPublisherConfig().setPublisherId("group2").setClassName("className"));
WanReplicationConfig actual = cloneThroughJson(expected);
assertTrue("Expected: " + expected + ", got:" + actual, WAN_REPLICATION_CONFIG_CHECKER.check(expected, actual));
}
use of com.hazelcast.config.WanBatchPublisherConfig in project cas by apereo.
the class HazelcastConfigurationFactory method buildWanReplicationSettingsForConfig.
private static void buildWanReplicationSettingsForConfig(final BaseHazelcastProperties hz, final Config config) {
val wan = hz.getCluster().getWanReplication();
val wanReplicationConfig = new WanReplicationConfig();
wanReplicationConfig.setName(wan.getReplicationName());
wan.getTargets().forEach(target -> {
val publisherConfig = new WanBatchPublisherConfig();
publisherConfig.setClassName(target.getPublisherClassName());
publisherConfig.setQueueFullBehavior(WanQueueFullBehavior.valueOf(target.getQueueFullBehavior()));
publisherConfig.setQueueCapacity(target.getQueueCapacity());
publisherConfig.setAcknowledgeType(WanAcknowledgeType.valueOf(target.getAcknowledgeType()));
publisherConfig.setBatchSize(target.getBatchSize());
publisherConfig.setBatchMaxDelayMillis(target.getBatchMaximumDelayMilliseconds());
publisherConfig.setResponseTimeoutMillis(target.getResponseTimeoutMilliseconds());
publisherConfig.setSnapshotEnabled(target.isSnapshotEnabled());
publisherConfig.setTargetEndpoints(target.getEndpoints());
publisherConfig.setClusterName(target.getClusterName());
publisherConfig.setPublisherId(target.getPublisherId());
publisherConfig.setMaxConcurrentInvocations(target.getExecutorThreadCount());
publisherConfig.setInitialPublisherState(WanPublisherState.REPLICATING);
publisherConfig.setProperties(target.getProperties());
publisherConfig.setSyncConfig(new WanSyncConfig().setConsistencyCheckStrategy(ConsistencyCheckStrategy.valueOf(target.getConsistencyCheckStrategy())));
wanReplicationConfig.addBatchReplicationPublisherConfig(publisherConfig);
});
config.addWanReplicationConfig(wanReplicationConfig);
}
use of com.hazelcast.config.WanBatchPublisherConfig in project hazelcast by hazelcast.
the class AddWanBatchPublisherConfigMessageTask method call.
@Override
protected Object call() throws Exception {
WanReplicationConfig wanConfig = new WanReplicationConfig();
wanConfig.setName(parameters.name);
WanBatchPublisherConfig publisherConfig = new WanBatchPublisherConfig();
publisherConfig.setPublisherId(parameters.publisherId);
publisherConfig.setClusterName(parameters.targetCluster);
publisherConfig.setTargetEndpoints(parameters.endpoints);
publisherConfig.setQueueCapacity(parameters.queueCapacity);
publisherConfig.setBatchSize(parameters.batchSize);
publisherConfig.setBatchMaxDelayMillis(parameters.batchMaxDelayMillis);
publisherConfig.setResponseTimeoutMillis(parameters.responseTimeoutMillis);
WanAcknowledgeType ackType = WanAcknowledgeType.getById(parameters.ackType);
publisherConfig.setAcknowledgeType(ackType != null ? ackType : DEFAULT_ACKNOWLEDGE_TYPE);
WanQueueFullBehavior queueFullBehavior = WanQueueFullBehavior.getByType(parameters.queueFullBehavior);
publisherConfig.setQueueFullBehavior(queueFullBehavior != null ? queueFullBehavior : DEFAULT_QUEUE_FULL_BEHAVIOUR);
wanConfig.addBatchReplicationPublisherConfig(publisherConfig);
return nodeEngine.getWanReplicationService().addWanReplicationConfig(wanConfig);
}
Aggregations