Search in sources :

Example 1 with WanCustomPublisherConfig

use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.

the class DynamicConfigXmlGenerator method wanReplicationXmlGenerator.

public static void wanReplicationXmlGenerator(ConfigXmlGenerator.XmlGenerator gen, Config config) {
    for (WanReplicationConfig wan : config.getWanReplicationConfigs().values()) {
        gen.open("wan-replication", "name", wan.getName());
        for (WanBatchPublisherConfig p : wan.getBatchPublisherConfigs()) {
            wanBatchReplicationPublisherXmlGenerator(gen, p);
        }
        for (WanCustomPublisherConfig p : wan.getCustomPublisherConfigs()) {
            wanCustomPublisherXmlGenerator(gen, p);
        }
        WanConsumerConfig consumerConfig = wan.getConsumerConfig();
        if (consumerConfig != null) {
            wanReplicationConsumerGenerator(gen, consumerConfig);
        }
        gen.close();
    }
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig)

Example 2 with WanCustomPublisherConfig

use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.

the class DynamicConfigYamlGenerator method getWanCustomPublisherConfigsAsMap.

private static Map<String, Object> getWanCustomPublisherConfigsAsMap(List<WanCustomPublisherConfig> wanCustomPublisherConfigs) {
    if (wanCustomPublisherConfigs == null || wanCustomPublisherConfigs.isEmpty()) {
        return null;
    }
    Map<String, Object> wanBatchPublisherConfigsAsMap = new LinkedHashMap<>();
    for (WanCustomPublisherConfig wanCustomPublisherConfig : wanCustomPublisherConfigs) {
        Map<String, Object> wanCustomPublisherConfigAsMap = new LinkedHashMap<>();
        addNonNullToMap(wanCustomPublisherConfigAsMap, "class-name", wanCustomPublisherConfig.getClassName());
        addNonNullToMap(wanCustomPublisherConfigAsMap, "properties", getPropertiesAsMap(wanCustomPublisherConfig.getProperties()));
        wanBatchPublisherConfigsAsMap.put(wanCustomPublisherConfig.getPublisherId(), wanCustomPublisherConfigAsMap);
    }
    return wanBatchPublisherConfigsAsMap;
}
Also used : WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with WanCustomPublisherConfig

use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.

the class WanReplicationConfigDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    if (config.getName() != null) {
        root.add("name", config.getName());
    }
    JsonArray batchPublishers = new JsonArray();
    JsonArray customPublishers = new JsonArray();
    for (WanBatchPublisherConfig publisherConfig : config.getBatchPublisherConfigs()) {
        batchPublishers.add(new WanBatchPublisherConfigDTO(publisherConfig).toJson());
    }
    for (WanCustomPublisherConfig publisherConfig : config.getCustomPublisherConfigs()) {
        customPublishers.add(new CustomWanPublisherConfigDTO(publisherConfig).toJson());
    }
    root.add("batchPublishers", batchPublishers);
    root.add("customPublishers", customPublishers);
    WanConsumerConfig consumerConfig = config.getConsumerConfig();
    if (consumerConfig != null) {
        root.add("consumer", new WanConsumerConfigDTO(consumerConfig).toJson());
    }
    return root;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) JsonObject(com.hazelcast.internal.json.JsonObject)

Example 4 with WanCustomPublisherConfig

use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.

the class AbstractWanCustomPublisherMapTest method programmaticImplCreationTest.

@Test
public void programmaticImplCreationTest() {
    Config config = getConfig();
    WanCustomPublisherConfig publisherConfig = config.getWanReplicationConfig("dummyWan").getCustomPublisherConfigs().get(0);
    WanDummyPublisher dummyWanReplication = new WanDummyPublisher();
    publisherConfig.setImplementation(dummyWanReplication);
    instance1 = factory.newHazelcastInstance(config);
    assertEquals(dummyWanReplication, getWanReplicationImpl(instance1));
}
Also used : WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) Config(com.hazelcast.config.Config) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) Test(org.junit.Test)

Example 5 with WanCustomPublisherConfig

use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.

the class WanPublisherMigrationTest method getConfig.

@Override
protected Config getConfig() {
    WanCustomPublisherConfig publisherConfig = new WanCustomPublisherConfig().setPublisherId("dummyPublisherId").setClassName(MigrationCountingWanPublisher.class.getName());
    publisherConfig.getProperties().put("failMigrations", failMigrations);
    WanReplicationConfig wanReplicationConfig = new WanReplicationConfig().setName("dummyWan").addCustomPublisherConfig(publisherConfig);
    WanReplicationRef wanRef = new WanReplicationRef().setName("dummyWan").setMergePolicyClassName(PassThroughMergePolicy.class.getName());
    MapConfig mapConfig = new MapConfig("default").setWanReplicationRef(wanRef);
    return smallInstanceConfig().addWanReplicationConfig(wanReplicationConfig).addMapConfig(mapConfig);
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) PassThroughMergePolicy(com.hazelcast.spi.merge.PassThroughMergePolicy) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) MapConfig(com.hazelcast.config.MapConfig)

Aggregations

WanCustomPublisherConfig (com.hazelcast.config.WanCustomPublisherConfig)17 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)8 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)7 WanConsumerConfig (com.hazelcast.config.WanConsumerConfig)6 Test (org.junit.Test)6 MapConfig (com.hazelcast.config.MapConfig)4 QuickTest (com.hazelcast.test.annotation.QuickTest)3 AttributeConfig (com.hazelcast.config.AttributeConfig)2 AwsConfig (com.hazelcast.config.AwsConfig)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 DataPersistenceConfig (com.hazelcast.config.DataPersistenceConfig)2 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)2 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)2 DiskTierConfig (com.hazelcast.config.DiskTierConfig)2 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)2 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)2