Class ReliableTopicConfig
- All Implemented Interfaces:
- NamedConfig,- UserCodeNamespaceAwareConfig<ReliableTopicConfig>,- DataSerializable,- IdentifiedDataSerializable,- com.hazelcast.nio.serialization.impl.Versioned
ITopic.
 
 The reliable topic makes use of a Ringbuffer
 to store the actual messages.
 
To configure the ringbuffer for a reliable topic, define a ringbuffer in the config with exactly the same name. It is very unlikely that you want to run with the default settings.
 When a ReliableTopic starts, it will always start from the tail+1
 item from the RingBuffer. It will not chew its way through all available
 events but it will wait for the next item being published.
 
In the reliable topic, global order is always maintained, so all listeners will observe exactly the same order of sequence of messages.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe default read batch size.static final booleanDefault value for statistics enabled.static final TopicOverloadPolicyThe default slow consumer policy.Fields inherited from interface com.hazelcast.config.UserCodeNamespaceAwareConfigDEFAULT_NAMESPACE
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new ReliableTopicConfig by cloning an existing one.ReliableTopicConfig(String name) Creates a new ReliableTopicConfig with default settings.
- 
Method SummaryModifier and TypeMethodDescriptionaddMessageListenerConfig(ListenerConfig listenerConfig) Adds a message listener (listens for when messages are added or removed) to this reliable topic.final booleanintReturns type identifier for this class.Gets the Executor that is going to process the events.intReturns DataSerializableFactory factory ID for this class.Gets the list of message listeners (listens for when messages are added or removed) for this reliable topic.getName()Gets the name of the reliable topic.intGets the maximum number of items to read in a batch.Gets the TopicOverloadPolicy for this reliable topic.Retrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.final inthashCode()booleanChecks if statistics are enabled for this reliable topic.voidReads fields from the input streamsetExecutor(Executor executor) Sets the executor that is going to process the event.setMessageListenerConfigs(List<ListenerConfig> listenerConfigs) Sets the list of message listeners (listens for when messages are added or removed) for this topic.Sets the name of the reliable topic.setReadBatchSize(int readBatchSize) Sets the read batch size.setStatisticsEnabled(boolean statisticsEnabled) Enables or disables statistics for this reliable topic.setTopicOverloadPolicy(TopicOverloadPolicy topicOverloadPolicy) Sets the TopicOverloadPolicy for this reliable topic.setUserCodeNamespace(String userCodeNamespace) Associates the provided Namespace Name with this structure forClassLoaderawareness.toString()voidWrites object fields to output stream
- 
Field Details- 
DEFAULT_READ_BATCH_SIZEpublic static final int DEFAULT_READ_BATCH_SIZEThe default read batch size.- See Also:
 
- 
DEFAULT_TOPIC_OVERLOAD_POLICYThe default slow consumer policy.
- 
DEFAULT_STATISTICS_ENABLEDpublic static final boolean DEFAULT_STATISTICS_ENABLEDDefault value for statistics enabled.- See Also:
 
 
- 
- 
Constructor Details- 
ReliableTopicConfigpublic ReliableTopicConfig()
- 
ReliableTopicConfigCreates a new ReliableTopicConfig with default settings.
- 
ReliableTopicConfigCreates a new ReliableTopicConfig by cloning an existing one.- Parameters:
- config- the ReliableTopicConfig to clone
 
 
- 
- 
Method Details- 
setNameSets the name of the reliable topic.- Specified by:
- setNamein interface- NamedConfig
- Parameters:
- name- the name of the reliable topic
- Returns:
- the updated ReliableTopicConfig
- Throws:
- IllegalArgumentException- if name is- null
 
- 
getNameGets the name of the reliable topic.- Specified by:
- getNamein interface- NamedConfig
- Returns:
- the name of the reliable topic
 
- 
getTopicOverloadPolicyGets the TopicOverloadPolicy for this reliable topic.- Returns:
- the TopicOverloadPolicy
 
- 
setTopicOverloadPolicySets the TopicOverloadPolicy for this reliable topic. Check theTopicOverloadPolicyfor more details about this setting.- Parameters:
- topicOverloadPolicy- the new TopicOverloadPolicy
- Returns:
- the updated reliable topic config
- Throws:
- IllegalArgumentException- if topicOverloadPolicy is- null
 
- 
getExecutorGets the Executor that is going to process the events.If no Executor is selected, then the ExecutionService.ASYNC_EXECUTORis used.- Returns:
- the Executor used to process events
- See Also:
 
- 
setExecutorSets the executor that is going to process the event.In some cases it is desirable to set a specific executor. For example, you may want to isolate a certain topic from other topics because it contains long running messages or very high priority messages. A single executor can be shared between multiple Reliable topics, although it could take more time to process a message. If a single executor is not shared with other reliable topics, then the executor only needs to have a single thread. - Parameters:
- executor- the executor. if the executor is null, the- ExecutionService.ASYNC_EXECUTORwill be used to process the event
- Returns:
- the updated config
 
- 
getReadBatchSizepublic int getReadBatchSize()Gets the maximum number of items to read in a batch. Returned value will always be equal or larger than 1.- Returns:
- the read batch size
 
- 
setReadBatchSizeSets the read batch size.The ReliableTopic tries to read a batch of messages from the ringbuffer. It will get at least one, but if there are more available, then it will try to get more to increase throughput. The maximum read batch size can be influenced using the read batch size. Apart from influencing the number of messages to retrieve, the readBatchSizealso determines how many messages will be processed by the thread running theMessageListenerbefore it returns back to the pool to look for otherMessageListeners that need to be processed. The problem with returning to the pool and looking for new work is that interacting with an executor is quite expensive due to contention on the work-queue. The more work that can be done without retuning to the pool, the smaller the overhead.If the readBatchSizeis 10 and there are 50 messages available, 10 items are retrieved and processed consecutively before the thread goes back to the pool and helps out with the processing of other messages.If the readBatchSizeis 10 and there are 2 items available, 2 items are retrieved and processed consecutively.If the readBatchSizeis an issue because a thread will be busy too long with processing a singleMessageListenerand it can't help out otherMessageListeners, increase the size of the threadpool so the otherMessageListeners don't need to wait for a thread, but can be processed in parallel.- Parameters:
- readBatchSize- the maximum number of items to read in a batch
- Returns:
- the updated reliable topic config
- Throws:
- IllegalArgumentException- if the- readBatchSizeis smaller than 1
 
- 
isStatisticsEnabledpublic boolean isStatisticsEnabled()Checks if statistics are enabled for this reliable topic.- Returns:
- trueif enabled,- falseotherwise
 
- 
setStatisticsEnabledEnables or disables statistics for this reliable topic. Collects the creation time, total number of published and received messages for each member locally.- Parameters:
- statisticsEnabled-- trueto enable statistics,- falseto disable
- Returns:
- the updated reliable topic config
 
- 
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
 
- 
getMessageListenerConfigsGets the list of message listeners (listens for when messages are added or removed) for this reliable topic.- Returns:
- list of MessageListener configurations
 
- 
addMessageListenerConfigAdds a message listener (listens for when messages are added or removed) to this reliable topic.- Parameters:
- listenerConfig- the ListenerConfig to add
- Returns:
- the updated config
- Throws:
- NullPointerException- if listenerConfig is- null
 
- 
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<ReliableTopicConfig>
- 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<ReliableTopicConfig>
- Parameters:
- userCodeNamespace- The ID of the Namespace to associate with this structure.
- Returns:
- the updated ReliableTopicConfiginstance
- Since:
- 5.4
 
- 
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.
 
- 
equals
- 
hashCodepublic final int hashCode()
 
-