Search in sources :

Example 1 with TopicConfig

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

the class TopicMBean method getConfig.

@ManagedAnnotation("config")
public String getConfig() {
    Config config = service.instance.getConfig();
    TopicConfig topicConfig = config.findTopicConfig(managedObject.getName());
    return topicConfig.toString();
}
Also used : Config(com.hazelcast.config.Config) TopicConfig(com.hazelcast.config.TopicConfig) TopicConfig(com.hazelcast.config.TopicConfig)

Example 2 with TopicConfig

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

the class TopicProxySupport method initialize.

@Override
public void initialize() {
    NodeEngine nodeEngine = getNodeEngine();
    TopicConfig config = nodeEngine.getConfig().findTopicConfig(name);
    multithreaded = config.isMultiThreadingEnabled();
    for (ListenerConfig listenerConfig : config.getMessageListenerConfigs()) {
        initialize(listenerConfig);
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ListenerConfig(com.hazelcast.config.ListenerConfig) TopicConfig(com.hazelcast.config.TopicConfig)

Example 3 with TopicConfig

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

the class YamlMemberDomConfigProcessor method handleTopic.

@Override
protected void handleTopic(Node node) {
    for (Node topicNode : childElements(node)) {
        TopicConfig topicConfig = new TopicConfig();
        topicConfig.setName(topicNode.getNodeName());
        handleTopicNode(topicNode, topicConfig);
    }
}
Also used : Node(org.w3c.dom.Node) YamlNode(com.hazelcast.internal.yaml.YamlNode) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) TopicConfig(com.hazelcast.config.TopicConfig)

Example 4 with TopicConfig

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

the class DynamicConfigYamlGenerator method topicYamlGenerator.

public static void topicYamlGenerator(Map<String, Object> parent, Config config) {
    if (config.getTopicConfigs().isEmpty()) {
        return;
    }
    Map<String, Object> child = new LinkedHashMap<>();
    for (TopicConfig subConfigAsObject : config.getTopicConfigs().values()) {
        Map<String, Object> subConfigAsMap = new LinkedHashMap<>();
        addNonNullToMap(subConfigAsMap, "statistics-enabled", subConfigAsObject.isStatisticsEnabled());
        addNonNullToMap(subConfigAsMap, "global-ordering-enabled", subConfigAsObject.isGlobalOrderingEnabled());
        addNonNullToMap(subConfigAsMap, "message-listeners", getListenerConfigsAsList(subConfigAsObject.getMessageListenerConfigs()));
        addNonNullToMap(subConfigAsMap, "multi-threading-enabled", subConfigAsObject.isMultiThreadingEnabled());
        child.put(subConfigAsObject.getName(), subConfigAsMap);
    }
    parent.put("topic", child);
}
Also used : ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) TopicConfig(com.hazelcast.config.TopicConfig) LinkedHashMap(java.util.LinkedHashMap)

Example 5 with TopicConfig

use of com.hazelcast.config.TopicConfig 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)

Aggregations

TopicConfig (com.hazelcast.config.TopicConfig)23 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)16 ListenerConfig (com.hazelcast.config.ListenerConfig)9 Test (org.junit.Test)9 Config (com.hazelcast.config.Config)8 RingbufferConfig (com.hazelcast.config.RingbufferConfig)8 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)7 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)7 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)7 ExecutorConfig (com.hazelcast.config.ExecutorConfig)7 FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)7 ListConfig (com.hazelcast.config.ListConfig)7 MapConfig (com.hazelcast.config.MapConfig)7 MultiMapConfig (com.hazelcast.config.MultiMapConfig)7 PNCounterConfig (com.hazelcast.config.PNCounterConfig)7 QueueConfig (com.hazelcast.config.QueueConfig)7 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)7 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)7 SetConfig (com.hazelcast.config.SetConfig)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7