|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.messaging.MessageFacade | +--org.arch4j.messaging.MessageTopicFacade
This class provides clients with a simplified and provider-independent
interface to JMS message topics. It is not intended to be a full wrapper
around JMS functionality. An instance of this class represents a single
TopicSession
. The class gives access to topic publishers,
subscribers, and durable subscribers as well as the topic connection,
the topic session, existing topics, and new messages.
As an example of using the message topic facade:
MessageTopicFacade tFacade =
MessagingProvider.getProvider().getMessageTopicFacade(false);
TopicSubscriber subscriber = tFacade.createTopicSubscriber("exampleTopic");
subscriber.setMessageListener(this);
tFacade.startConnection();
...
subscriber.close();
tFacade.close();
Constructor Summary | |
protected |
MessageTopicFacade()
Constructs an instance of MessageTopicFacade . |
Method Summary | |
void |
close()
Since a provider typically allocates resources outside the JVM on behalf of a Session , clients
should close them when they are not needed. |
javax.jms.TopicSubscriber |
createDurableTopicSubscriber(String topicName,
String subscriptionID)
Create a durable TopicSubscriber using the session instance
associated with this facade. |
javax.jms.TopicSubscriber |
createDurableTopicSubscriber(String topicName,
String subscriptionID,
String messageSelector,
boolean noLocal)
Create a durable TopicSubscriber using the session instance
associated with this facade. |
javax.jms.TopicPublisher |
createTopicPublisher(String topicName)
Create a TopicPublisher using the session instance
associated with this facade. |
javax.jms.TopicSubscriber |
createTopicSubscriber(String topicName)
Create a TopicSubscriber using the session instance
associated with this facade. |
javax.jms.TopicSubscriber |
createTopicSubscriber(String topicName,
String messageSelector,
boolean noLocal)
Create a TopicSubscriber with the specified message selector
and local message filter specifier using the session instance
associated with this facade. |
protected javax.jms.Session |
getSession()
Returns a Session reference to the TopicSession
instance associated with this object. |
javax.jms.TopicConnection |
getTopicConnection()
Returns a reference to the TopicConnection instance. |
protected abstract javax.jms.TopicConnectionFactory |
getTopicConnectionFactory()
Interface method to retrieve a TopicConnectionFactory . |
javax.jms.TopicSession |
getTopicSession()
Returns a reference to the TopicSession associated with
this object. |
void |
initialize(boolean isTransactional)
Initialize the new instance. |
protected void |
initialize(boolean isTransactional,
int acknowledgeMode)
Initialize the new instance. |
abstract javax.jms.Topic |
lookupTopic(String topicName)
Interface method to retrieve a Topic . |
void |
startConnection()
Start (or restart) a Connection's delivery of incoming messages. |
void |
unsubscribeDurableSubscription(String subscriptionID)
Unsubscribe the durable subscription named by the subscriptionID . |
Methods inherited from class org.arch4j.messaging.MessageFacade |
commit, createBytesMessage, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createStreamMessage, createTextMessage, createTextMessage, rollback |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected MessageTopicFacade()
MessageTopicFacade
.
It is a protected
method as the only class who
should instantiate this is MessagingProvider
.
Method Detail |
protected void initialize(boolean isTransactional, int acknowledgeMode)
MessagingProvider
.
public void initialize(boolean isTransactional)
MessagingProvider
.
public void startConnection()
public void close()
Session
, clients
should close them when they are not needed. Relying on garbage collection
to eventually reclaim these resources may not be timely enough.
Note: Do not close the static topicConnection
here as
other Session
s may be relying on it.
protected abstract javax.jms.TopicConnectionFactory getTopicConnectionFactory()
TopicConnectionFactory
. Details
of retrieval are implementation specific.
public abstract javax.jms.Topic lookupTopic(String topicName)
Topic
. Details of retrieval
are implementation specific.
Topic
, if it exists. Otherwise, null
.public javax.jms.TopicSession getTopicSession()
TopicSession
associated with
this object.
protected javax.jms.Session getSession()
Session
reference to the TopicSession
instance associated with this object. Implements the abstract superclass
method.
getSession
in class MessageFacade
public javax.jms.TopicConnection getTopicConnection()
TopicConnection
instance.
public javax.jms.TopicPublisher createTopicPublisher(String topicName)
TopicPublisher
using the session instance
associated with this facade.
public javax.jms.TopicSubscriber createDurableTopicSubscriber(String topicName, String subscriptionID)
TopicSubscriber
using the session instance
associated with this facade.
topicName
- The name of the topic to associate the subscriber with.subscriptionID
- The name used to identify this subscription.public javax.jms.TopicSubscriber createDurableTopicSubscriber(String topicName, String subscriptionID, String messageSelector, boolean noLocal)
TopicSubscriber
using the session instance
associated with this facade.
topicName
- The name of the topic to associate the subscriber with.subscriptionID
- The name used to identify this subscription.messageSelector
- only messages with properties matching the message selector expression
are delivered. This value may be null.noLocal
- if set, inhibits the delivery of messages published by its own connection.public javax.jms.TopicSubscriber createTopicSubscriber(String topicName)
TopicSubscriber
using the session instance
associated with this facade.
topicName
- The name of the topic to associate the subscriber with.public javax.jms.TopicSubscriber createTopicSubscriber(String topicName, String messageSelector, boolean noLocal)
TopicSubscriber
with the specified message selector
and local message filter specifier using the session instance
associated with this facade.
topicName
- The name of the topic to associate the subscriber with.messageSelector
- only messages with properties matching the message selector expression
are delivered. This value may be null.noLocal
- if set, inhibits the delivery of messages published by its own connection.public void unsubscribeDurableSubscription(String subscriptionID)
subscriptionID
.
This deletes the state being maintained on behalf of the subscriber by its provider.
subscriptionID
- The name used to identify this subscription.
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |