Search in sources :

Example 6 with WanBatchPublisherConfig

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());
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) HashMap(java.util.HashMap) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) ListConfig(com.hazelcast.config.ListConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) AwsConfig(com.hazelcast.config.AwsConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) PredicateConfig(com.hazelcast.config.PredicateConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) PartitioningStrategyConfig(com.hazelcast.config.PartitioningStrategyConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) DiskTierConfig(com.hazelcast.config.DiskTierConfig) IndexConfig(com.hazelcast.config.IndexConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) ItemListenerConfig(com.hazelcast.config.ItemListenerConfig) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) AttributeConfig(com.hazelcast.config.AttributeConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) CachePartitionLostListenerConfig(com.hazelcast.config.CachePartitionLostListenerConfig) DataPersistenceConfig(com.hazelcast.config.DataPersistenceConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) MemoryTierConfig(com.hazelcast.config.MemoryTierConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) Test(org.junit.Test)

Example 7 with WanBatchPublisherConfig

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));
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) EurekaConfig(com.hazelcast.config.EurekaConfig) AwsConfig(com.hazelcast.config.AwsConfig) WanSyncConfig(com.hazelcast.config.WanSyncConfig) HashMap(java.util.HashMap) AzureConfig(com.hazelcast.config.AzureConfig) KubernetesConfig(com.hazelcast.config.KubernetesConfig) GcpConfig(com.hazelcast.config.GcpConfig) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with WanBatchPublisherConfig

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));
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with WanBatchPublisherConfig

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);
}
Also used : lombok.val(lombok.val) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanSyncConfig(com.hazelcast.config.WanSyncConfig)

Example 10 with WanBatchPublisherConfig

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);
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanAcknowledgeType(com.hazelcast.config.WanAcknowledgeType) WanQueueFullBehavior(com.hazelcast.config.WanQueueFullBehavior)

Aggregations

WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)18 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)11 WanCustomPublisherConfig (com.hazelcast.config.WanCustomPublisherConfig)8 Test (org.junit.Test)8 WanConsumerConfig (com.hazelcast.config.WanConsumerConfig)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 AwsConfig (com.hazelcast.config.AwsConfig)4 WanSyncConfig (com.hazelcast.config.WanSyncConfig)4 AzureConfig (com.hazelcast.config.AzureConfig)3 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)3 EurekaConfig (com.hazelcast.config.EurekaConfig)3 GcpConfig (com.hazelcast.config.GcpConfig)3 KubernetesConfig (com.hazelcast.config.KubernetesConfig)3 HashMap (java.util.HashMap)3 AttributeConfig (com.hazelcast.config.AttributeConfig)2 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)2 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)2 CacheSimpleEntryListenerConfig (com.hazelcast.config.CacheSimpleEntryListenerConfig)2 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)2 Config (com.hazelcast.config.Config)2