Package org.rribbit.dispatching
Class JmsRequestDispatcher
java.lang.Object
org.rribbit.dispatching.JmsRequestDispatcher
- All Implemented Interfaces:
RequestDispatcher
This
RequestDispatcher dispatches Requests 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 Requests to the JmsRequestDispatcher will always yield an empty Response, because JMS is a one-way protocol. No response will ever come back.
The Responses 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
ConstructorsConstructorDescriptionWhenever you use this constructor, be sure to set theQueueAND theConnectionFactorywith the setters provided by this class.JmsRequestDispatcher(jakarta.jms.ConnectionFactory connectionFactory, jakarta.jms.Queue queue) Creates a newJmsRequestDispatcherthat dispatchesMessages to the givenQueue, using the givenConnectionFactory. -
Method Summary
Modifier and TypeMethodDescription<T> Response<T> dispatchRequest(Request request) voidsetConnectionFactory(jakarta.jms.ConnectionFactory connectionFactory) voidsetQueue(jakarta.jms.Queue queue)
-
Constructor Details
-
JmsRequestDispatcher
public JmsRequestDispatcher()Whenever you use this constructor, be sure to set theQueueAND theConnectionFactorywith 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 newJmsRequestDispatcherthat dispatchesMessages to the givenQueue, using the givenConnectionFactory. This constructor is recommended, since it forces you to specify theQueueandConnectionFactory. Passing a null value for either of these will result in runtime exceptions whenever theJmsRequestDispatcheris used.- Parameters:
connectionFactory-queue-
-
-
Method Details
-
dispatchRequest
Description copied from interface:RequestDispatcher- Specified by:
dispatchRequestin interfaceRequestDispatcher- Parameters:
request- TheRequestto be dispatched to aRequestProcessor- Returns:
- The
Responseto be returned from theRequestProcessor
-
setConnectionFactory
public void setConnectionFactory(jakarta.jms.ConnectionFactory connectionFactory) -
setQueue
public void setQueue(jakarta.jms.Queue queue)
-