Search in sources :

Example 1 with QueueConfig

use of com.hazelcast.config.QueueConfig in project spring-boot by spring-projects.

the class HazelcastAutoConfigurationTests method configInstanceWithoutName.

@Test
public void configInstanceWithoutName() {
    load(HazelcastConfigNoName.class, "spring.hazelcast.config=this-is-ignored.xml");
    HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
    Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig().getQueueConfigs();
    assertThat(queueConfigs).hasSize(1).containsKey("another-queue");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QueueConfig(com.hazelcast.config.QueueConfig) Test(org.junit.Test)

Example 2 with QueueConfig

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

the class TestBeansApplicationContext method testPlaceHolder.

@Test
public void testPlaceHolder() {
    HazelcastInstance instance = (HazelcastInstance) context.getBean("instance");
    waitInstanceForSafeState(instance);
    Config config = instance.getConfig();
    assertEquals("spring-cluster", config.getClusterName());
    assertFalse(config.getNetworkConfig().getJoin().getTcpIpConfig().isEnabled());
    assertEquals(6, config.getMapConfig("map1").getBackupCount());
    assertFalse(config.getMapConfig("map1").isStatisticsEnabled());
    assertEquals(64, config.getNativeMemoryConfig().getSize().getValue());
    QueueConfig testQueue = config.getQueueConfig("testQueue");
    assertEquals("com.hazelcast.collection.impl.queue.model.PriorityElementComparator", testQueue.getPriorityComparatorClassName());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QueueConfig(com.hazelcast.config.QueueConfig) QueueConfig(com.hazelcast.config.QueueConfig) MapConfig(com.hazelcast.config.MapConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with QueueConfig

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

the class DynamicConfigXmlGenerator method queueXmlGenerator.

public static void queueXmlGenerator(ConfigXmlGenerator.XmlGenerator gen, Config config) {
    Collection<QueueConfig> qCfgs = config.getQueueConfigs().values();
    for (QueueConfig q : qCfgs) {
        gen.open("queue", "name", q.getName()).node("priority-comparator-class-name", q.getPriorityComparatorClassName()).node("statistics-enabled", q.isStatisticsEnabled()).node("max-size", q.getMaxSize()).node("backup-count", q.getBackupCount()).node("async-backup-count", q.getAsyncBackupCount()).node("empty-queue-ttl", q.getEmptyQueueTtl());
        appendItemListenerConfigs(gen, q.getItemListenerConfigs());
        QueueStoreConfig storeConfig = q.getQueueStoreConfig();
        if (storeConfig != null) {
            gen.open("queue-store", "enabled", storeConfig.isEnabled()).node("class-name", classNameOrImplClass(storeConfig.getClassName(), storeConfig.getStoreImplementation())).node("factory-class-name", classNameOrImplClass(storeConfig.getFactoryClassName(), storeConfig.getFactoryImplementation())).appendProperties(storeConfig.getProperties()).close();
        }
        MergePolicyConfig mergePolicyConfig = q.getMergePolicyConfig();
        gen.node("split-brain-protection-ref", q.getSplitBrainProtectionName()).node("merge-policy", mergePolicyConfig.getPolicy(), "batch-size", mergePolicyConfig.getBatchSize()).close();
    }
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) QueueConfig(com.hazelcast.config.QueueConfig)

Example 4 with QueueConfig

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

the class ClusterWideConfigurationService method registerConfigLocally.

/**
 * Register a dynamic configuration in a local member. When a dynamic configuration with the same name already
 * exists then this call has no effect.
 *
 * @param newConfig       Configuration to register.
 * @param configCheckMode behaviour when a config is detected
 * @throws UnsupportedOperationException when given configuration type is not supported
 * @throws InvalidConfigurationException when conflict is detected and configCheckMode is on THROW_EXCEPTION
 */
@SuppressWarnings("checkstyle:methodlength")
public void registerConfigLocally(IdentifiedDataSerializable newConfig, ConfigCheckMode configCheckMode) {
    IdentifiedDataSerializable currentConfig;
    if (newConfig instanceof MultiMapConfig) {
        MultiMapConfig multiMapConfig = (MultiMapConfig) newConfig;
        currentConfig = multiMapConfigs.putIfAbsent(multiMapConfig.getName(), multiMapConfig);
    } else if (newConfig instanceof MapConfig) {
        MapConfig newMapConfig = (MapConfig) newConfig;
        currentConfig = mapConfigs.putIfAbsent(newMapConfig.getName(), newMapConfig);
        if (currentConfig == null) {
            listener.onConfigRegistered(newMapConfig);
        }
    } else if (newConfig instanceof CardinalityEstimatorConfig) {
        CardinalityEstimatorConfig cardinalityEstimatorConfig = (CardinalityEstimatorConfig) newConfig;
        currentConfig = cardinalityEstimatorConfigs.putIfAbsent(cardinalityEstimatorConfig.getName(), cardinalityEstimatorConfig);
    } else if (newConfig instanceof RingbufferConfig) {
        RingbufferConfig ringbufferConfig = (RingbufferConfig) newConfig;
        currentConfig = ringbufferConfigs.putIfAbsent(ringbufferConfig.getName(), ringbufferConfig);
    } else if (newConfig instanceof ListConfig) {
        ListConfig listConfig = (ListConfig) newConfig;
        currentConfig = listConfigs.putIfAbsent(listConfig.getName(), listConfig);
    } else if (newConfig instanceof SetConfig) {
        SetConfig setConfig = (SetConfig) newConfig;
        currentConfig = setConfigs.putIfAbsent(setConfig.getName(), setConfig);
    } else if (newConfig instanceof ReplicatedMapConfig) {
        ReplicatedMapConfig replicatedMapConfig = (ReplicatedMapConfig) newConfig;
        currentConfig = replicatedMapConfigs.putIfAbsent(replicatedMapConfig.getName(), replicatedMapConfig);
    } else if (newConfig instanceof TopicConfig) {
        TopicConfig topicConfig = (TopicConfig) newConfig;
        currentConfig = topicConfigs.putIfAbsent(topicConfig.getName(), topicConfig);
    } else if (newConfig instanceof ExecutorConfig) {
        ExecutorConfig executorConfig = (ExecutorConfig) newConfig;
        currentConfig = executorConfigs.putIfAbsent(executorConfig.getName(), executorConfig);
    } else if (newConfig instanceof DurableExecutorConfig) {
        DurableExecutorConfig durableExecutorConfig = (DurableExecutorConfig) newConfig;
        currentConfig = durableExecutorConfigs.putIfAbsent(durableExecutorConfig.getName(), durableExecutorConfig);
    } else if (newConfig instanceof ScheduledExecutorConfig) {
        ScheduledExecutorConfig scheduledExecutorConfig = (ScheduledExecutorConfig) newConfig;
        currentConfig = scheduledExecutorConfigs.putIfAbsent(scheduledExecutorConfig.getName(), scheduledExecutorConfig);
    } else if (newConfig instanceof QueueConfig) {
        QueueConfig queueConfig = (QueueConfig) newConfig;
        currentConfig = queueConfigs.putIfAbsent(queueConfig.getName(), queueConfig);
    } else if (newConfig instanceof ReliableTopicConfig) {
        ReliableTopicConfig reliableTopicConfig = (ReliableTopicConfig) newConfig;
        currentConfig = reliableTopicConfigs.putIfAbsent(reliableTopicConfig.getName(), reliableTopicConfig);
    } else if (newConfig instanceof CacheSimpleConfig) {
        CacheSimpleConfig cacheSimpleConfig = (CacheSimpleConfig) newConfig;
        currentConfig = cacheSimpleConfigs.putIfAbsent(cacheSimpleConfig.getName(), cacheSimpleConfig);
        if (currentConfig == null) {
            listener.onConfigRegistered(cacheSimpleConfig);
        }
    } else if (newConfig instanceof FlakeIdGeneratorConfig) {
        FlakeIdGeneratorConfig config = (FlakeIdGeneratorConfig) newConfig;
        currentConfig = flakeIdGeneratorConfigs.putIfAbsent(config.getName(), config);
    } else if (newConfig instanceof PNCounterConfig) {
        PNCounterConfig config = (PNCounterConfig) newConfig;
        currentConfig = pnCounterConfigs.putIfAbsent(config.getName(), config);
    } else {
        throw new UnsupportedOperationException("Unsupported config type: " + newConfig);
    }
    checkCurrentConfigNullOrEqual(configCheckMode, currentConfig, newConfig);
    persist(newConfig);
}
Also used : IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) TopicConfig(com.hazelcast.config.TopicConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) SetConfig(com.hazelcast.config.SetConfig) MapConfig(com.hazelcast.config.MapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ListConfig(com.hazelcast.config.ListConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig)

Example 5 with QueueConfig

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

the class QueueReplicationOperation method run.

@Override
public void run() {
    QueueService service = getService();
    NodeEngine nodeEngine = getNodeEngine();
    Config config = nodeEngine.getConfig();
    for (Map.Entry<String, QueueContainer> entry : migrationData.entrySet()) {
        String name = entry.getKey();
        QueueContainer container = entry.getValue();
        QueueConfig conf = config.findQueueConfig(name);
        container.setConfig(conf, nodeEngine, service);
        service.addContainer(name, container);
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) QueueConfig(com.hazelcast.config.QueueConfig) Config(com.hazelcast.config.Config) QueueConfig(com.hazelcast.config.QueueConfig) QueueContainer(com.hazelcast.collection.impl.queue.QueueContainer) QueueService(com.hazelcast.collection.impl.queue.QueueService) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap) Map(java.util.Map)

Aggregations

QueueConfig (com.hazelcast.config.QueueConfig)35 Test (org.junit.Test)13 Config (com.hazelcast.config.Config)12 QuickTest (com.hazelcast.test.annotation.QuickTest)11 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 MapConfig (com.hazelcast.config.MapConfig)7 QueueStoreConfig (com.hazelcast.config.QueueStoreConfig)7 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)6 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)5 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)5 ExecutorConfig (com.hazelcast.config.ExecutorConfig)5 FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)5 ItemListenerConfig (com.hazelcast.config.ItemListenerConfig)5 ListConfig (com.hazelcast.config.ListConfig)5 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 PNCounterConfig (com.hazelcast.config.PNCounterConfig)5 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)5 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)5