com.hazelcast.topic.impl
Class TopicProxy<E>

java.lang.Object
  extended by com.hazelcast.spi.AbstractDistributedObject<TopicService>
      extended by com.hazelcast.topic.impl.TopicProxy<E>
All Implemented Interfaces:
DistributedObject, ITopic<E>, InitializingObject
Direct Known Subclasses:
TotalOrderedTopicProxy

public class TopicProxy<E>
extends AbstractDistributedObject<TopicService>
implements ITopic<E>


Field Summary
 
Fields inherited from class com.hazelcast.spi.AbstractDistributedObject
PARTITIONING_STRATEGY
 
Constructor Summary
TopicProxy(String name, NodeEngine nodeEngine, TopicService service)
           
 
Method Summary
 String addMessageListener(MessageListener<E> listener)
          Subscribes to this topic.
 String addMessageListenerInternal(MessageListener listener)
           
 LocalTopicStats getLocalTopicStats()
          Returns statistics about this topic, like total number of publishes/receives
 LocalTopicStats getLocalTopicStatsInternal()
           
 String getName()
          Returns the unique name for this DistributedObject.
 String getServiceName()
          Returns the service name for this object.
 void initialize()
           
 void publish(E message)
          Publishes the message to all subscribers of this topic
 void publishInternal(Data message)
           
 boolean removeMessageListener(String registrationId)
          Stops receiving messages for the given message listener.
 boolean removeMessageListenerInternal(String registrationId)
           
 
Methods inherited from class com.hazelcast.spi.AbstractDistributedObject
destroy, equals, getId, getNameAsPartitionAwareData, getNodeEngine, getPartitionKey, getService, hashCode, invalidate, postDestroy, throwNotActiveException, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.ITopic
getName
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey, getServiceName
 

Constructor Detail

TopicProxy

public TopicProxy(String name,
                  NodeEngine nodeEngine,
                  TopicService service)
Method Detail

publish

public void publish(E message)
Description copied from interface: ITopic
Publishes the message to all subscribers of this topic

Specified by:
publish in interface ITopic<E>
Parameters:
message - the message to publish to all subscribers of this topic

addMessageListener

public String addMessageListener(MessageListener<E> listener)
Description copied from interface: ITopic
Subscribes to this topic. When someone publishes a message on this topic. onMessage() function of the given MessageListener is called. More than one message listener can be added on one instance.

Specified by:
addMessageListener in interface ITopic<E>
Returns:
returns the registration id.

removeMessageListener

public boolean removeMessageListener(String registrationId)
Description copied from interface: ITopic
Stops receiving messages for the given message listener. If the given listener already removed, this method does nothing.

Specified by:
removeMessageListener in interface ITopic<E>
Parameters:
registrationId - Id of listener registration.
Returns:
true if registration is removed, false otherwise

getLocalTopicStats

public LocalTopicStats getLocalTopicStats()
Description copied from interface: ITopic
Returns statistics about this topic, like total number of publishes/receives

Specified by:
getLocalTopicStats in interface ITopic<E>
Returns:
statistics about this topic

initialize

public void initialize()
Specified by:
initialize in interface InitializingObject

getLocalTopicStatsInternal

public LocalTopicStats getLocalTopicStatsInternal()

publishInternal

public void publishInternal(Data message)

addMessageListenerInternal

public String addMessageListenerInternal(MessageListener listener)

removeMessageListenerInternal

public boolean removeMessageListenerInternal(String registrationId)

getServiceName

public String getServiceName()
Description copied from interface: DistributedObject
Returns the service name for this object.

Specified by:
getServiceName in interface DistributedObject
Specified by:
getServiceName in class AbstractDistributedObject<TopicService>
Returns:
the service name for this object.

getName

public String getName()
Description copied from interface: DistributedObject
Returns the unique name for this DistributedObject. The returned value will never be null.

Specified by:
getName in interface DistributedObject
Returns:
the unique name for this object.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.