|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.activemq.bean.Requestor
A helper class for performing remote method invocations over JMS.
This class is a polymorphic version of the QueueRequestor
and TopicRequestor
that ship with the JMS API which take advantage of the polymorphism of JMS 1.1 and which also supports timeouts.
Constructor Summary | |
Requestor(Session session,
Destination destination)
Constructor for the Requestor class. |
Method Summary | |
void |
close()
Closes the Requestor and its session. |
protected TemporaryQueue |
createTemporaryDestination(Session session)
|
long |
getMaximumTimeout()
|
Message |
request(Message message)
Sends a request and waits for a reply. |
Message |
request(Message message,
long timeout)
Sends a request and waits for a reply up to a maximum timeout. |
void |
setMaximumTimeout(long maximumTimeout)
Sets the maximum default timeout used for remote requests. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Requestor(Session session, Destination destination) throws JMSException
Requestor
class.
This implementation assumes the session parameter to be non-transacted,
with a delivery mode of either AUTO_ACKNOWLEDGE
or
DUPS_OK_ACKNOWLEDGE
.
session
- the Session
the queue belongs todestination
- the destination to perform the request/reply call on
JMSException
- if the JMS provider fails to create the
Requestor
due to some internal
error.
InvalidDestinationException
- if an invalid queue is specified.Method Detail |
public Message request(Message message) throws JMSException
JMSReplyTo
destination, and only one reply per request
is expected.
message
- the message to send
JMSException
- if the JMS provider fails to complete the
request due to some internal error.public Message request(Message message, long timeout) throws JMSException
JMSReplyTo
destination, and only one reply per request
is expected.
message
- the message to send
JMSException
- if the JMS provider fails to complete the
request due to some internal error.public void close() throws JMSException
Requestor
and its session.
Since a provider may allocate some resources on behalf of a
Requestor
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 the Session
object
passed to the Requestor
constructor.
JMSException
- if the JMS provider fails to close the
Requestor
due to some internal
error.public long getMaximumTimeout()
public void setMaximumTimeout(long maximumTimeout)
maximumTimeout
- protected TemporaryQueue createTemporaryDestination(Session session) throws JMSException
JMSException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |