com.hazelcast.client.proxy

## Class ClientTopicProxy<E>

- java.lang.Object
- - com.hazelcast.client.spi.ClientProxy
  - - com.hazelcast.client.proxy.ClientTopicProxy<E>

- Type Parameters:
    `E` - message type
  All Implemented Interfaces:
    DistributedObject, ITopic<E>

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

  Proxy implementation of `ITopic`.

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.client.spi.ClientProxy

      `name`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientTopicProxy(String serviceName, String objectId, ClientContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `addMessageListener(MessageListener<E> listener)` Subscribes to this topic.
    `LocalTopicStats` | `getLocalTopicStats()` Returns statistics about this topic, like total number of publishes/receives.
    `protected com.hazelcast.client.impl.protocol.ClientMessage` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage req)`
    `protected <T> T` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, long invocationTimeoutSeconds)`
    `protected <T> ClientDelegatingFuture<T>` | `invokeOnPartitionAsync(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, long invocationTimeoutSeconds)`
    `protected void` | `onInitialize()` Called when proxy is created.
    `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

      `deregisterListener, destroy, destroyLocally, destroyRemotely, equals, getClient, getConnectedServerVersion, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onShutdown, postDestroy, preDestroy, registerListener, setContext, 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, getPartitionKey, getServiceName`

- - ### Constructor Detail

    - #### ClientTopicProxy

          public ClientTopicProxy(String serviceName,
                                  String objectId,
                                  ClientContext context)

  - ### 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 a message is published, the `MessageListener.onMessage(Message)` method of the given MessageListener is called. More than one message listener can be added on one instance.
      Specified by:
        `addMessageListener` in interface `ITopic<E>`
      Parameters:
        `listener` - the MessageListener to add
      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. The statistics are local to this member and represent the activity on this member, not the entire cluster.
      Specified by:
        `getLocalTopicStats` in interface `ITopic<E>`
      Returns:
        statistics about this topic

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### onInitialize

          protected void onInitialize()

      Description copied from class: `ClientProxy`
      Called when proxy is created. Overriding implementations can add initialization specific logic into this method like registering a listener, creating a cleanup task etc.
      Overrides:
        `onInitialize` in class `ClientProxy`

    - #### invokeOnPartition

          protected com.hazelcast.client.impl.protocol.ClientMessage invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage req)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

    - #### invokeOnPartitionAsync

          protected <T> ClientDelegatingFuture<T> invokeOnPartitionAsync(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                                         com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder)

    - #### invokeOnPartition

          protected <T> T invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                            long invocationTimeoutSeconds)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                         long invocationTimeoutSeconds)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

Copyright © 2019. All rights reserved.