Package com.hazelcast.config
Class TopicConfig
java.lang.Object
com.hazelcast.config.TopicConfig
- All Implemented Interfaces:
- NamedConfig,- UserCodeNamespaceAwareConfig<TopicConfig>,- DataSerializable,- IdentifiedDataSerializable,- com.hazelcast.nio.serialization.impl.Versioned
public class TopicConfig
extends Object
implements IdentifiedDataSerializable, NamedConfig, com.hazelcast.nio.serialization.impl.Versioned, UserCodeNamespaceAwareConfig<TopicConfig>
Contains the configuration for a 
ITopic.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final booleanDefault global ordering configuration.Fields inherited from interface com.hazelcast.config.UserCodeNamespaceAwareConfigDEFAULT_NAMESPACE
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a TopicConfig.TopicConfig(TopicConfig config) Creates aTopicConfigby cloning another TopicConfig.TopicConfig(String name) Creates a TopicConfig with the given name.
- 
Method SummaryModifier and TypeMethodDescriptionaddMessageListenerConfig(ListenerConfig listenerConfig) Adds a message listener to this topic (listens for when messages are added or removed).final booleanintReturns type identifier for this class.intReturns DataSerializableFactory factory ID for this class.Gets the list of message listeners (listens for when messages are added or removed) for this topic.getName()Gets the name of the topic, null if nothing is set.Retrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.final inthashCode()booleanChecks if global ordering is enabled (all nodes listening to the same topic get their messages in the same order), or disabled (nodes get the messages in the order that the messages are published).booleanChecks if multi-threaded processing of incoming messages is enabled or not.booleanChecks if statistics are enabled for this topic.voidReads fields from the input streamsetGlobalOrderingEnabled(boolean globalOrderingEnabled) Enable global ordering (all nodes listening to the same topic get their messages in the same order), or disable it (nodes get the messages in the order that the messages are published).setMessageListenerConfigs(List<ListenerConfig> listenerConfigs) Sets the list of message listeners (listens for when messages are added or removed) for this topic.setMultiThreadingEnabled(boolean multiThreadingEnabled) Enable multi-threaded message handling.Sets the name of the topic.setStatisticsEnabled(boolean statisticsEnabled) Enables or disables statistics for this topic.setUserCodeNamespace(String userCodeNamespace) Associates the provided Namespace Name with this structure forClassLoaderawareness.toString()voidWrites object fields to output stream
- 
Field Details- 
DEFAULT_GLOBAL_ORDERING_ENABLEDpublic static final boolean DEFAULT_GLOBAL_ORDERING_ENABLEDDefault global ordering configuration.- See Also:
 
 
- 
- 
Constructor Details- 
TopicConfigpublic TopicConfig()Creates a TopicConfig.
- 
TopicConfigCreates a TopicConfig with the given name.- Parameters:
- name- the name of the Topic
 
- 
TopicConfigCreates aTopicConfigby cloning another TopicConfig.- Parameters:
- config- the TopicConfig to clone
 
 
- 
- 
Method Details- 
getNameGets the name of the topic, null if nothing is set.- Specified by:
- getNamein interface- NamedConfig
- Returns:
- the name of the topic
 
- 
setNameSets the name of the topic.- Specified by:
- setNamein interface- NamedConfig
- Parameters:
- name- the topic name to set
- Returns:
- the updated TopicConfig
- Throws:
- IllegalArgumentException- if name is- nullor an empty string
 
- 
isGlobalOrderingEnabledpublic boolean isGlobalOrderingEnabled()Checks if global ordering is enabled (all nodes listening to the same topic get their messages in the same order), or disabled (nodes get the messages in the order that the messages are published).- Returns:
- true if global ordering is enabled, false if disabled
 
- 
setGlobalOrderingEnabledEnable global ordering (all nodes listening to the same topic get their messages in the same order), or disable it (nodes get the messages in the order that the messages are published).- Parameters:
- globalOrderingEnabled- set to- trueto enable global ordering,- falseto disable
- Returns:
- the updated TopicConfig
 
- 
isMultiThreadingEnabledpublic boolean isMultiThreadingEnabled()Checks if multi-threaded processing of incoming messages is enabled or not. When disabled only one dedicated thread will handle all topic messages. Otherwise any thread from events thread pool can be used for message handling.- Returns:
- trueif multi-threading is enabled,- falseif disabled
 
- 
setMultiThreadingEnabledEnable multi-threaded message handling. When enabled any thread from events thread pool can be used for incoming message processing. Otherwise only one dedicated thread will be used to handle topic messages. Note: it can be enabled only in case when global ordering is disabled. Moreover, the local message ordering is not supported in this mode also. This means the messages produced by local publisher can be processed by several threads with no ordering guarantee.- Parameters:
- multiThreadingEnabled- set to- trueto enable multi-threaded message processing,- falseto disable
- Returns:
- the updated TopicConfig
 
- 
addMessageListenerConfigAdds a message listener to this topic (listens for when messages are added or removed).- Parameters:
- listenerConfig- the message listener to add to this topic
 
- 
getMessageListenerConfigsGets the list of message listeners (listens for when messages are added or removed) for this topic.- Returns:
- the list of message listeners for this topic
 
- 
setMessageListenerConfigsSets the list of message listeners (listens for when messages are added or removed) for this topic.- Parameters:
- listenerConfigs- the list of message listeners for this topic
- Returns:
- this updated topic configuration
 
- 
isStatisticsEnabledpublic boolean isStatisticsEnabled()Checks if statistics are enabled for this topic.- Returns:
- trueif statistics are enabled,- falseotherwise
 
- 
setStatisticsEnabledEnables or disables statistics for this topic.- Parameters:
- statisticsEnabled-- trueto enable statistics for this topic,- falseto disable
- Returns:
- the updated TopicConfig
 
- 
getUserCodeNamespaceRetrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.- Specified by:
- getUserCodeNamespacein interface- UserCodeNamespaceAwareConfig<TopicConfig>
- Returns:
- Namespace Name for use with the UserCodeNamespaceService, ornullif there is no User Code Namespace to associate with.
 
- 
setUserCodeNamespaceAssociates the provided Namespace Name with this structure forClassLoaderawareness.The behaviour of setting this to nullis outlined in the documentation forUserCodeNamespaceAwareConfig.DEFAULT_NAMESPACE.- Specified by:
- setUserCodeNamespacein interface- UserCodeNamespaceAwareConfig<TopicConfig>
- Parameters:
- userCodeNamespace- The ID of the Namespace to associate with this structure.
- Returns:
- the updated TopicConfiginstance
- Since:
- 5.4
 
- 
equals
- 
hashCodepublic final int hashCode()
- 
toString
- 
getFactoryIdpublic int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
- getFactoryIdin interface- IdentifiedDataSerializable
- Returns:
- factory ID
 
- 
getClassIdpublic int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
- getClassIdin interface- IdentifiedDataSerializable
- Returns:
- type ID
 
- 
writeDataDescription copied from interface:DataSerializableWrites object fields to output stream- Specified by:
- writeDatain interface- DataSerializable
- Parameters:
- out- output
- Throws:
- IOException- if an I/O error occurs. In particular, an- IOExceptionmay be thrown if the output stream has been closed.
 
- 
readDataDescription copied from interface:DataSerializableReads fields from the input stream- Specified by:
- readDatain interface- DataSerializable
- Parameters:
- in- input
- Throws:
- IOException- if an I/O error occurs. In particular, an- IOExceptionmay be thrown if the input stream has been closed.
 
 
-