java.lang.Object | +--javax.jms.QueueRequestor
TheQueueRequestor
helper class simplifies making service requests.
TheQueueRequestor
constructor is given a non-transactedQueueSession
and a destinationQueue
. It creates aTemporaryQueue
for the responses and provides arequest
method that sends the request message and waits for its reply.
This is a basic request/reply abstraction that should be sufficient for most uses. JMS providers and clients are free to create more sophisticated versions.
TopicRequestor
QueueRequestor(QueueSession session,Queue queue) Constructor for the QueueRequestor class. |
close() Closes the QueueRequestor and its session. | |
request(Message message) Sends a request and waits for a reply. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
publicQueueRequestor(QueueSession session,Queue queue) throwsJMSException
QueueRequestor
class.This implementation assumes the session parameter to be non-transacted, with a delivery mode of eitherAUTO_ACKNOWLEDGE
orDUPS_OK_ACKNOWLEDGE
.
session
- theQueueSession
the queue belongs toqueue
- the queue to perform the request/reply call onJMSException
- if the JMS provider fails to create theQueueRequestor
due to some internal error.InvalidDestinationException
- if an invalid queue is specified.publicMessagerequest(Message message) throwsJMSException
JMSReplyTo
destination, and only one reply per request is expected.message
- the message to sendJMSException
- if the JMS provider fails to complete the request due to some internal error.public voidclose() throwsJMSException
QueueRequestor
and its session.Since a provider may allocate some resources on behalf of aQueueRequestor
outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
Note that this method closes theQueueSession
object passed to theQueueRequestor
constructor.
JMSException
- if the JMS provider fails to close theQueueRequestor
due to some internal error.