public class ReliableTopicConfigReadOnly extends ReliableTopicConfig
DEFAULT_READ_BATCH_SIZE, DEFAULT_STATISTICS_ENABLED, DEFAULT_TOPIC_OVERLOAD_POLICY| Constructor and Description |
|---|
ReliableTopicConfigReadOnly(ReliableTopicConfig config) |
| Modifier and Type | Method and Description |
|---|---|
ReliableTopicConfig |
addMessageListenerConfig(ListenerConfig listenerConfig)
Adds a message listener (listens for when messages are added or removed)
to this reliable topic.
|
ReliableTopicConfig |
setExecutor(Executor executor)
Sets the executor that is going to process the event.
|
ReliableTopicConfig |
setReadBatchSize(int readBatchSize)
Sets the read batch size.
|
ReliableTopicConfig |
setStatisticsEnabled(boolean statisticsEnabled)
Enables or disables statistics for this reliable topic.
|
ReliableTopicConfig |
setTopicOverloadPolicy(TopicOverloadPolicy topicOverloadPolicy)
Sets the TopicOverloadPolicy for this reliable topic.
|
equals, getClassId, getExecutor, getFactoryId, getMessageListenerConfigs, getName, getReadBatchSize, getTopicOverloadPolicy, hashCode, isStatisticsEnabled, readData, setMessageListenerConfigs, setName, toString, writeDatapublic ReliableTopicConfigReadOnly(ReliableTopicConfig config)
public ReliableTopicConfig setExecutor(Executor executor)
ReliableTopicConfigIn 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.
setExecutor in class ReliableTopicConfigexecutor - the executor. if the executor is null, the
ExecutionService.ASYNC_EXECUTOR will be used
to process the eventpublic ReliableTopicConfig setReadBatchSize(int readBatchSize)
ReliableTopicConfigThe 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
readBatchSize also determines how many messages will be processed
by the thread running the MessageListener before it returns back
to the pool to look for other MessageListeners 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 readBatchSize is 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 readBatchSize is 10 and there are 2 items available,
2 items are retrieved and processed consecutively.
If the readBatchSize is an issue because a thread will be busy
too long with processing a single MessageListener and it can't
help out other MessageListeners, increase the size of the
threadpool so the other MessageListeners don't need to wait for
a thread, but can be processed in parallel.
setReadBatchSize in class ReliableTopicConfigreadBatchSize - the maximum number of items to read in a batchpublic ReliableTopicConfig setStatisticsEnabled(boolean statisticsEnabled)
ReliableTopicConfigsetStatisticsEnabled in class ReliableTopicConfigstatisticsEnabled - true to enable statistics, false to disablepublic ReliableTopicConfig addMessageListenerConfig(ListenerConfig listenerConfig)
ReliableTopicConfigaddMessageListenerConfig in class ReliableTopicConfiglistenerConfig - the ListenerConfig to addpublic ReliableTopicConfig setTopicOverloadPolicy(TopicOverloadPolicy topicOverloadPolicy)
ReliableTopicConfigTopicOverloadPolicy for more details about this setting.setTopicOverloadPolicy in class ReliableTopicConfigtopicOverloadPolicy - the new TopicOverloadPolicyCopyright © 2019 Hazelcast, Inc.. All rights reserved.