Topic Configuration

The following are example topic configurations.

Declarative Configuration:

  <topic name="yourTopicName">

Programmatic Configuration:

TopicConfig topicConfig = new TopicConfig();
topicConfig.setGlobalOrderingEnabled( true );
topicConfig.setStatisticsEnabled( true );
topicConfig.setName( "yourTopicName" );
MessageListener<String> implementation = new MessageListener<String>() {
  public void onMessage( Message<String> message ) {
    // process the message
topicConfig.addMessageListenerConfig( new ListenerConfig( implementation ) );
HazelcastInstance instance = Hazelcast.newHazelcastInstance()

Topic configuration has the following elements.

  • statistics-enabled: Default is true, meaning statistics are calculated.
  • global-ordering-enabled: Default is false, meaning there is no global order guarantee.
  • message-listeners: Lets you add listeners (listener classes) for the topic messages.

Topic related but not topic specific configuration parameters

  • hazelcast.event.queue.capacity: default value is 1,000,000.
  • hazelcast.event.queue.timeout.millis: default value is 250.
  • hazelcast.event.thread.count: default value is 5.


For description of these parameters, please see Global Event Configuration.