Class ClientRequestor
java.lang.Object
org.apache.activemq.artemis.api.core.client.ClientRequestor
- All Implemented Interfaces:
AutoCloseable
The ClientRequestor class helps making requests.
The ClientRequestor constructor is given a ClientSession and a request address. It creates a temporary queue for the responses and provides a request method that sends the request message and waits for its reply.
The ClientRequestor constructor is given a ClientSession and a request address. It creates a temporary queue for the responses and provides a request method that sends the request message and waits for its reply.
-
Constructor Summary
ConstructorsConstructorDescriptionClientRequestor
(ClientSession session, String requestAddress) ClientRequestor
(ClientSession session, SimpleString requestAddress) Constructor for the ClientRequestor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the ClientRequestor and its session.request
(ClientMessage request) Sends a message to the request address and wait indefinitely for a reply.request
(ClientMessage request, long timeout) Sends a message to the request address and wait for the given timeout for a reply.
-
Constructor Details
-
ClientRequestor
Constructor for the ClientRequestor. The implementation expects a ClientSession with automatic commits of sends and acknowledgements- Parameters:
session
- a ClientSession uses to handle requests and repliesrequestAddress
- the address to send request messages to- Throws:
Exception
-
ClientRequestor
- Throws:
Exception
- See Also:
-
-
Method Details
-
request
Sends a message to the request address and wait indefinitely for a reply. The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected- Parameters:
request
- the message to send- Returns:
- the reply message
- Throws:
Exception
-
request
Sends a message to the request address and wait for the given timeout for a reply. The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected- Parameters:
request
- the message to sendtimeout
- the timeout to wait for a reply (in milliseconds)- Returns:
- the reply message or
null
if no message is replied before the timeout elapses - Throws:
Exception
-
close
Closes the ClientRequestor and its session.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
- if an exception occurs while closing the ClientRequestor
-