Package org.rribbit.dispatching
Class JmsRequestDispatcher
java.lang.Object
org.rribbit.dispatching.JmsRequestDispatcher
- All Implemented Interfaces:
RequestDispatcher
This
RequestDispatcher
dispatches Request
s via JMS. It uses the Spring Framework, because they have already done much of the work needed to use JMS. Please note that
you don't actually have to use the Spring Framework in order to use this class, as long as the necessary Spring libraries are available. See the pom.xml of RRiBbit for the libraries that
you need.
Dispatching Request
s to the JmsRequestDispatcher
will always yield an empty Response
, because JMS is a one-way protocol. No response will ever come back.
The Response
s returned by the JmsRequestDispatcher
therefore have an empty list with return values and an empty list with throwables. No null values are returned
however, so that the caller does not have to take that into account.
For more information, see this page.- Author:
- G.J. Schouten
-
Constructor Summary
ConstructorDescriptionWhenever you use this constructor, be sure to set theQueue
AND theConnectionFactory
with the setters provided by this class.JmsRequestDispatcher
(jakarta.jms.ConnectionFactory connectionFactory, jakarta.jms.Queue queue) Creates a newJmsRequestDispatcher
that dispatchesMessage
s to the givenQueue
, using the givenConnectionFactory
. -
Method Summary
Modifier and TypeMethodDescription<T> Response
<T> dispatchRequest
(Request request) void
setConnectionFactory
(jakarta.jms.ConnectionFactory connectionFactory) void
setQueue
(jakarta.jms.Queue queue)
-
Constructor Details
-
JmsRequestDispatcher
public JmsRequestDispatcher()Whenever you use this constructor, be sure to set theQueue
AND theConnectionFactory
with the setters provided by this class. If you don't, runtime exceptions will occur. -
JmsRequestDispatcher
public JmsRequestDispatcher(jakarta.jms.ConnectionFactory connectionFactory, jakarta.jms.Queue queue) Creates a newJmsRequestDispatcher
that dispatchesMessage
s to the givenQueue
, using the givenConnectionFactory
. This constructor is recommended, since it forces you to specify theQueue
andConnectionFactory
. Passing a null value for either of these will result in runtime exceptions whenever theJmsRequestDispatcher
is used.- Parameters:
connectionFactory
-queue
-
-
-
Method Details
-
dispatchRequest
Description copied from interface:RequestDispatcher
- Specified by:
dispatchRequest
in interfaceRequestDispatcher
- Parameters:
request
- TheRequest
to be dispatched to aRequestProcessor
- Returns:
- The
Response
to be returned from theRequestProcessor
-
setConnectionFactory
public void setConnectionFactory(jakarta.jms.ConnectionFactory connectionFactory) -
setQueue
public void setQueue(jakarta.jms.Queue queue)
-