org.richfaces.application.push

## Interface Topic

- All Known Implementing Classes:
    AbstractTopic, TopicImpl

      public interface Topic

  Topic encapsulates particular endpoint for sending/receiving messages.

  It is associated with TopicKey and in current implementation several Topic instances can be associated with the particular JMS Topic.

  Topic holds collection of TopicListener and one MessageDataSerializer.

  Author:
    Nick Belaevski

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTopicListener(TopicListener topicListener)` Adds listener through that topic events will be published (by calling `publishEvent(TopicEvent)`).
    `void` | `checkSubscription(Session session)` Checks that the given session can be subscribed to this topic
    `TopicKey` | `getKey()` Returns the key which this topic is associated with
    `MessageDataSerializer` | `getMessageDataSerializer()` Returns the `MessageDataSerializer` that is associated with this topic
    `void` | `publish(Object messageData)` Publish data to the subscribed clients
    `void` | `publish(Object messageData, String subtopicName)` Publish data to the subscribed clients
    `void` | `publishEvent(TopicEvent event)` Publishes topic event to all subscribed TopicListeners
    `void` | `removeTopicListener(TopicListener topicListener)` Removes topic listener
    `void` | `setMessageDataSerializer(MessageDataSerializer serializer)` Associated this topic with given `MessageDataSerializer`

- - ### Method Detail

    - #### getKey

          TopicKey getKey()

      Returns the key which this topic is associated with

    - #### getMessageDataSerializer

          MessageDataSerializer getMessageDataSerializer()

      Returns the `MessageDataSerializer` that is associated with this topic

    - #### setMessageDataSerializer

          void setMessageDataSerializer(MessageDataSerializer serializer)

      Associated this topic with given `MessageDataSerializer`
      Parameters:
        `serializer` -

    - #### addTopicListener

          void addTopicListener(TopicListener topicListener)

      Adds listener through that topic events will be published (by calling `publishEvent(TopicEvent)`).

    - #### removeTopicListener

          void removeTopicListener(TopicListener topicListener)

      Removes topic listener

    - #### checkSubscription

          void checkSubscription(Session session)
                          throws SubscriptionFailureException

      Checks that the given session can be subscribed to this topic
      Throws:
        `SubscriptionFailureException` - when given session can't be subscribed to this topic

    - #### publishEvent

          void publishEvent(TopicEvent event)

      Publishes topic event to all subscribed TopicListeners

    - #### publish

          void publish(Object messageData)
                throws MessageException

      Publish data to the subscribed clients
      Parameters:
        `messageData` - data that will be serialized by MessageDataSerializer
      Throws:
        `MessageException`

    - #### publish

          void publish(Object messageData,
                       String subtopicName)
                throws MessageException

      Publish data to the subscribed clients
      Parameters:
        `messageData` - data that will be serialized by MessageDataSerializer
        `subtopicName` - optional subtopic, used to publish to clients that are only interested in specific subtopics
      Throws:
        `MessageException`

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.