Class TopicManager

java.lang.Object
com.swiftmq.swiftlet.Swiftlet
com.swiftmq.swiftlet.topic.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 Details

    • TopicManager

      public TopicManager()
  • Method Details

    • getTopicQueuePrefix

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

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

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

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

      public abstract boolean isTopicDefined(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 String getQueueForTopic(String topicName)
      Returns the name of the topic queue for publish.
      Parameters:
      topicName - topic name.
      Returns:
      queue name.
    • tokenizeTopicName

      public String[] tokenizeTopicName(String topicName, 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 String[] tokenizeTopicName(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.
      Returns:
      tokenized array.
    • subscribe

      public int subscribe(String topicName, Selector selector, boolean noLocal, 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(String topicName, Selector selector, boolean noLocal, String queueName, boolean forceCopy) throws AuthenticationException
      Subscribes to a topic.
      Parameters:
      topicName - topic name.
      selector - selector or null.
      noLocal - no-local flag.
      queueName - subscriber queue name.
      forceCopy - forces a message copy for this subscription.
      Returns:
      subscription id.
      Throws:
      AuthenticationException - on authentication error.
    • subscribe

      public int subscribe(String topicName, Selector selector, boolean noLocal, 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, String queueName, ActiveLogin activeLogin) throws AuthenticationException
      Subscribes to a topic.
      Parameters:
      topic - topic.
      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, String queueName, ActiveLogin activeLogin, boolean forceCopy) throws AuthenticationException
      Subscribes to a topic.
      Parameters:
      topic - topic.
      selector - selector or null.
      noLocal - no-local flag.
      activeLogin - active login object.
      forceCopy - forces a message copy for this subscription.
      Returns:
      subscription id.
      Throws:
      AuthenticationException - on authentication error.
    • subscribeDurable

      public abstract String subscribeDurable(String durableName, TopicImpl topic, Selector selector, boolean noLocal, ActiveLogin activeLogin) throws AuthenticationException, QueueException, QueueAlreadyDefinedException, UnknownQueueException, TopicException
      Subscribe as durable subscriber.
      Parameters:
      durableName - durable name.
      topic - topic.
      selector - selector or null.
      noLocal - no-local flag.
      activeLogin - active login object.
      Returns:
      durable subscriber queue name.
      Throws:
      AuthenticationException - on authentication error.
      QueueException - queue manager exception.
      QueueAlreadyDefinedException - queue manager exception.
      UnknownQueueException - queue manager exception.
      TopicException - on topic manager exception.
    • deleteDurable

      public abstract void deleteDurable(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 String getDurableTopicName(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 String[] getTopicNames()
      Returns all defined topic names.
      Returns:
      array of topic names.