Class TimeoutEnabledQueueRequestor
TimeoutEnabledQueueRequestor helper class simplifies making
 service requests using the request/reply pattern.
 
 The TimeoutEnabledQueueRequestor constructor is given a
 non-transacted QueueSession and a destination
 Queue. It creates a TemporaryQueue for the
 responses and provides a request method that sends the request
 message and waits for its reply.
- Since:
- 4.0
- 
Constructor SummaryConstructorsConstructorDescriptionTimeoutEnabledQueueRequestor(javax.jms.Session session, javax.jms.Queue queue) Constructor for theTimeoutEnabledQueueRequestorclass.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes theTimeoutEnabledQueueRequestorand its session.javax.jms.Messagerequest(javax.jms.Message message) Sends a request and waits for a reply.javax.jms.Messagerequest(javax.jms.Message message, long timeout) Sends a request and waits for a reply.
- 
Constructor Details- 
TimeoutEnabledQueueRequestorpublic TimeoutEnabledQueueRequestor(javax.jms.Session session, javax.jms.Queue queue) throws javax.jms.JMSException Constructor for theTimeoutEnabledQueueRequestorclass.This implementation assumes the session parameter to be non-transacted, with a delivery mode of either AUTO_ACKNOWLEDGEorDUPS_OK_ACKNOWLEDGE.- Parameters:
- session- the- QueueSessionthe queue belongs to, session will not be closed by- TimeoutEnabledQueueRequestor
- queue- the queue to perform the request/reply call on
- Throws:
- javax.jms.JMSException- if the JMS provider fails to create the- TimeoutEnabledQueueRequestordue to some internal error.
- javax.jms.InvalidDestinationException- if an invalid queue is specified.
 
 
- 
- 
Method Details- 
requestpublic javax.jms.Message request(javax.jms.Message message) throws javax.jms.JMSException Sends a request and waits for a reply. The temporary queue is used for theJMSReplyTodestination, and only one reply per request is expected. The method blocks indefinitely until a message arrives!- Parameters:
- message- the message to send
- Returns:
- the reply message
- Throws:
- javax.jms.JMSException- if the JMS provider fails to complete the request due to some internal error.
 
- 
requestpublic javax.jms.Message request(javax.jms.Message message, long timeout) throws javax.jms.JMSException Sends a request and waits for a reply. The temporary queue is used for theJMSReplyTodestination, and only one reply per request is expected. The client waits/blocks for the reply until the timeout is reached.- Parameters:
- message- the message to send
- timeout- time to wait for a reply on temporary queue. If you specify no arguments or an argument of 0, the method blocks indefinitely until a message arrives
- Returns:
- the reply message
- Throws:
- javax.jms.JMSException- if the JMS provider fails to complete the request due to some internal error.
 
- 
closepublic void close() throws javax.jms.JMSExceptionCloses theTimeoutEnabledQueueRequestorand its session.Since a provider may allocate some resources on behalf of a TimeoutEnabledQueueRequestoroutside 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.This method closes the Sessionobject passed to theTimeoutEnabledQueueRequestorconstructor.- Throws:
- javax.jms.JMSException- if the JMS provider fails to close the- TimeoutEnabledQueueRequestordue to some internal error.
 
 
-