|
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.MessageQueueFacade
This class provides clients with a simplified and provider-independent
interface to JMS message queues. It is not intended to be a full wrapper
around JMS functionality. An instance of this class represents a single
QueueSession
. The class gives access to queue browsers, receivers,
and senders as well as the queue connection factory, the queue session, existing
queues, and new messages.
As an example of using the message queue facade:
MessageQueueFacade qFacade =
MessagingProvider.getProvider().getMessageQueueFacade(false);
QueueSender sender = qFacade.createQueueSender("exampleQueue");
qFacade.startConnection();
TextMessage message = qFacade.createTextMessage(new StringBuffer("Hello Whirled"));
sender.send(message);
sender.close();
qFacade.close();
Constructor Summary | |
protected |
MessageQueueFacade()
Constructs an instance of MessageQueueFacade . |
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. |
static void |
closeConnection()
Close the static queue Connection. |
javax.jms.QueueBrowser |
createQueueBrowser(String queueName,
String messageSelector)
Create a QueueBrowser . |
javax.jms.QueueReceiver |
createQueueReciever(String queueName,
String messageSelector)
Create a QueueBrowser . |
javax.jms.QueueSender |
createQueueSender(String queueName)
Create a QueueSender . |
javax.jms.QueueConnection |
getQueueConnection()
Returns a reference to the QueueConnection instance. |
protected abstract javax.jms.QueueConnectionFactory |
getQueueConnectionFactory()
Interface method to retrieve a QueueConnectionFactory . |
javax.jms.QueueSession |
getQueueSession()
Returns a reference to the QueueSession instance associated
with this object. |
protected javax.jms.Session |
getSession()
Returns a Session reference to the QueueSession
instance associated with this object. |
protected void |
initialize(boolean isTransactional)
Initialize the new instance. |
protected void |
initialize(boolean isTransactional,
int acknowledgeMode)
Initialize the new instance. |
abstract javax.jms.Queue |
lookupQueue(String queueName)
Interface method to retrieve a Queue . |
void |
startConnection()
Start (or restart) a Connection's delivery of incoming messages. |
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 MessageQueueFacade()
MessageQueueFacade
.
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
.
protected 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 queueConnection
here as
other Session
s may be relying on it.
public static void closeConnection()
protected abstract javax.jms.QueueConnectionFactory getQueueConnectionFactory()
QueueConnectionFactory
. Details
of retrieval are implementation specific.
public abstract javax.jms.Queue lookupQueue(String queueName)
Queue
. Details of retrieval
are implementation specific.
Queue
, if it exists. Otherwise, null
.public javax.jms.QueueSession getQueueSession()
QueueSession
instance associated
with this object.
protected javax.jms.Session getSession()
Session
reference to the QueueSession
instance associated with this object. Implements the abstract superclass method.
getSession
in class MessageFacade
public javax.jms.QueueConnection getQueueConnection()
QueueConnection
instance.
public javax.jms.QueueBrowser createQueueBrowser(String queueName, String messageSelector)
QueueBrowser
.
If the messageSelector is null
then the QueueBrowser
is created with no message selector.
Assumes that the queue specified exists, if not a
EnvironmentalException
is thrown.
QueueBrowser
public javax.jms.QueueReceiver createQueueReciever(String queueName, String messageSelector)
QueueBrowser
.
If the messageSelector is null
then the QueueBrowser
is created with no message selector.
Assumes that the queue specified exists, if not a
EnvironmentalException
is thrown.
QueueReceiver
public javax.jms.QueueSender createQueueSender(String queueName)
QueueSender
.
Assumes that the queue specified exists, if not a
EnvironmentalException
is thrown.
QueueSender
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |