Class TopicManager


  • public abstract class TopicManager
    extends Swiftlet
    The TopicManager manages topics. A topic can be hierarchical, e.g. 'iit.sales.eu'. Every topic has an associated queue which is returned on getQueueForTopic(). This queue is used to publish messages inside of queue transactions. Subsciptions are mapped either to temporary queues (non-durable) or a durable subscriber queue.
    Author:
    IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
    • Constructor Detail

      • TopicManager

        public TopicManager()
    • Method Detail

      • getTopicQueuePrefix

        protected abstract java.lang.String getTopicQueuePrefix()
        Returns the prefix for topic queues, e.g. 'tpc$'.
        Returns:
        prefix.
      • getTopicDelimiter

        protected abstract java.lang.String getTopicDelimiter()
        Returns the delimiter for hierarchical topics, e.g. '.' Additional verbose description.
        Returns:
        delimiter.
      • createTopic

        public abstract void createTopic​(java.lang.String topicName)
                                  throws TopicException
        Creates a topic.
        Parameters:
        topicName - topic name.
        Throws:
        TopicException - on error.
      • deleteTopic

        public abstract void deleteTopic​(java.lang.String topicName)
                                  throws TopicException
        Deletes a topic.
        Parameters:
        topicName - topic name.
        Throws:
        TopicException - on error.
      • isTopicDefined

        public abstract boolean isTopicDefined​(java.lang.String topicName)
        Returns whether a topic with that name is defined or not.
        Parameters:
        topicName - topic name.
        Returns:
        true/false.
      • verifyTopic

        public abstract TopicImpl verifyTopic​(TopicImpl topic)
                                       throws javax.jms.JMSException,
                                              javax.jms.InvalidDestinationException
        Verifies whether the topic is defined and accessible.
        Parameters:
        topic - topic.
        Returns:
        true/false.
        Throws:
        javax.jms.JMSException - on error.
        javax.jms.InvalidDestinationException - if the topic is invalid.
      • getQueueForTopic

        public java.lang.String getQueueForTopic​(java.lang.String topicName)
        Returns the name of the topic queue for publish.
        Parameters:
        topicName - topic name.
        Returns:
        queue name.
      • tokenizeTopicName

        public java.lang.String[] tokenizeTopicName​(java.lang.String topicName,
                                                    java.lang.String delimiter)
        Tokenizes a hierachical topic name by the delimiter. For example, 'iit.sales.eu' with delimiter '.' will return String[]{'iit','sales','eu'}.
        Parameters:
        topicName - topic name.
        delimiter - delimiter.
        Returns:
        tokenized array.
      • tokenizeTopicName

        public java.lang.String[] tokenizeTopicName​(java.lang.String topicName)
        Tokenizes a hierachical topic name by the default delimiter. For example, 'iit.sales.eu' will return String[]{'iit','sales','eu'}.
        Parameters:
        topicName - topic name.
        delimiter - delimiter.
        Returns:
        tokenized array.
      • subscribe

        public int subscribe​(java.lang.String topicName,
                             Selector selector,
                             boolean noLocal,
                             java.lang.String queueName)
                      throws AuthenticationException
        Subscribes to a topic.
        Parameters:
        topicName - topic name.
        selector - selector or null.
        noLocal - no-local flag.
        queueName - subscriber queue name.
        Returns:
        subscription id.
        Throws:
        AuthenticationException - on authentication error.
      • subscribe

        public int subscribe​(java.lang.String topicName,
                             Selector selector,
                             boolean noLocal,
                             java.lang.String queueName,
                             ActiveLogin activeLogin)
                      throws AuthenticationException
        Subscribes to a topic.
        Parameters:
        topicName - topic name.
        selector - selector or null.
        noLocal - no-local flag.
        activeLogin - active login object.
        Returns:
        subscription id.
        Throws:
        AuthenticationException - on authentication error.
      • subscribe

        public abstract int subscribe​(TopicImpl topic,
                                      Selector selector,
                                      boolean noLocal,
                                      java.lang.String queueName,
                                      ActiveLogin activeLogin)
                               throws AuthenticationException
        Subscribes to a topic.
        Parameters:
        topicName - topic.
        selector - selector or null.
        noLocal - no-local flag.
        activeLogin - active login object.
        Returns:
        subscription id.
        Throws:
        AuthenticationException - on authentication error.
      • deleteDurable

        public abstract void deleteDurable​(java.lang.String durableName,
                                           ActiveLogin activeLogin)
                                    throws javax.jms.InvalidDestinationException,
                                           QueueException,
                                           UnknownQueueException,
                                           TopicException
        Delete a durable subscriber. Deletes not only the subscription but also the durable subscriber queue.
        Parameters:
        durableName - durable name.
        activeLogin - active login object.
        Throws:
        javax.jms.InvalidDestinationException - queue manager exception.
        QueueException - queue manager exception.
        UnknownQueueException - queue manager exception.
        TopicException - on topic manager exception.
      • getDurableTopicName

        public abstract java.lang.String getDurableTopicName​(java.lang.String durableName,
                                                             ActiveLogin activeLogin)
        Returns the topic name for which the durable subscriber is subcribed
        Parameters:
        durableName - durable name.
        activeLogin - active login object.
        Returns:
        topic name or null if the durable is not found
      • unsubscribe

        public abstract void unsubscribe​(int subscriberId)
        Unsubscribe a non-durable subscription.
        Parameters:
        subscriberId - subscriber id.
      • getTopicNames

        public abstract java.lang.String[] getTopicNames()
        Returns all defined topic names.
        Returns:
        array of topic names.