Package com.swiftmq.swiftlet.topic
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 ongetQueueForTopic()
. 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
-
-
Field Summary
-
Fields inherited from class com.swiftmq.swiftlet.Swiftlet
STATE_ACTIVE, STATE_INACTIVE, STATE_STANDBY
-
-
Constructor Summary
Constructors Constructor Description TopicManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
createTopic(java.lang.String topicName)
Creates a topic.abstract void
deleteDurable(java.lang.String durableName, ActiveLogin activeLogin)
Delete a durable subscriber.abstract void
deleteTopic(java.lang.String topicName)
Deletes a topic.abstract java.lang.String
getDurableTopicName(java.lang.String durableName, ActiveLogin activeLogin)
Returns the topic name for which the durable subscriber is subcribedjava.lang.String
getQueueForTopic(java.lang.String topicName)
Returns the name of the topic queue for publish.protected abstract java.lang.String
getTopicDelimiter()
Returns the delimiter for hierarchical topics, e.g.abstract java.lang.String[]
getTopicNames()
Returns all defined topic names.protected abstract java.lang.String
getTopicQueuePrefix()
Returns the prefix for topic queues, e.g.abstract boolean
isTopicDefined(java.lang.String topicName)
Returns whether a topic with that name is defined or not.abstract int
subscribe(TopicImpl topic, Selector selector, boolean noLocal, java.lang.String queueName, ActiveLogin activeLogin)
Subscribes to a topic.int
subscribe(java.lang.String topicName, Selector selector, boolean noLocal, java.lang.String queueName)
Subscribes to a topic.int
subscribe(java.lang.String topicName, Selector selector, boolean noLocal, java.lang.String queueName, ActiveLogin activeLogin)
Subscribes to a topic.abstract java.lang.String
subscribeDurable(java.lang.String durableName, TopicImpl topic, Selector selector, boolean noLocal, ActiveLogin activeLogin)
Subscribe as durable subscriber.java.lang.String[]
tokenizeTopicName(java.lang.String topicName)
Tokenizes a hierachical topic name by the default delimiter.java.lang.String[]
tokenizeTopicName(java.lang.String topicName, java.lang.String delimiter)
Tokenizes a hierachical topic name by the delimiter.abstract void
unsubscribe(int subscriberId)
Unsubscribe a non-durable subscription.abstract TopicImpl
verifyTopic(TopicImpl topic)
Verifies whether the topic is defined and accessible.-
Methods inherited from class com.swiftmq.swiftlet.Swiftlet
getName, getStartupTime, getState, isSnapshotAvailable, resume, setStartupTime, shutdown, standby, startup
-
-
-
-
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.
-
subscribeDurable
public abstract java.lang.String subscribeDurable(java.lang.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(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.
-
-