com.hazelcast.client.proxy
Class ClientTopicProxy<E>

java.lang.Object
  extended by com.hazelcast.client.spi.ClientProxy
      extended by com.hazelcast.client.proxy.ClientTopicProxy<E>
All Implemented Interfaces:
DistributedObject, ITopic<E>

public class ClientTopicProxy<E>
extends ClientProxy
implements ITopic<E>


Constructor Summary
ClientTopicProxy(String serviceName, String objectId)
           
 
Method Summary
 String addMessageListener(MessageListener<E> listener)
          Subscribes to this topic.
 LocalTopicStats getLocalTopicStats()
          Returns statistics about this topic, like total number of publishes/receives
protected
<T> T
invoke(ClientRequest req)
           
 void publish(E message)
          Publishes the message to all subscribers of this topic
 boolean removeMessageListener(String registrationId)
          Stops receiving messages for the given message listener.
 String toString()
           
 
Methods inherited from class com.hazelcast.client.spi.ClientProxy
destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invokeInterruptibly, listen, listen, onDestroy, onInitialize, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObject
 
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

ClientTopicProxy

public ClientTopicProxy(String serviceName,
                        String objectId)
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

invoke

protected <T> T invoke(ClientRequest req)
Overrides:
invoke in class ClientProxy

toString

public String toString()
Overrides:
toString in class Object


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