|
32 | 32 | * {@code receive(..)} methods that mirror various JMS API methods.
|
33 | 33 | * See the JMS specification and javadocs for details on those methods.
|
34 | 34 | *
|
| 35 | + * <p>Provides also basic request reply operation using a temporary |
| 36 | + * queue to collect the reply. |
| 37 | + * |
35 | 38 | * @author Mark Pollack
|
36 | 39 | * @author Juergen Hoeller
|
| 40 | + * @author Stephane Nicoll |
37 | 41 | * @since 1.1
|
38 | 42 | * @see JmsTemplate
|
39 | 43 | * @see javax.jms.Destination
|
@@ -83,9 +87,9 @@ public interface JmsOperations {
|
83 | 87 | <T> T execute(String destinationName, ProducerCallback<T> action) throws JmsException;
|
84 | 88 |
|
85 | 89 |
|
86 |
| - //------------------------------------------------------------------------- |
| 90 | + //--------------------------------------------------------------------------------------- |
87 | 91 | // Convenience methods for sending messages
|
88 |
| - //------------------------------------------------------------------------- |
| 92 | + //--------------------------------------------------------------------------------------- |
89 | 93 |
|
90 | 94 | /**
|
91 | 95 | * Send a message to the default destination.
|
@@ -115,9 +119,9 @@ public interface JmsOperations {
|
115 | 119 | void send(String destinationName, MessageCreator messageCreator) throws JmsException;
|
116 | 120 |
|
117 | 121 |
|
118 |
| - //------------------------------------------------------------------------- |
| 122 | + //--------------------------------------------------------------------------------------- |
119 | 123 | // Convenience methods for sending auto-converted messages
|
120 |
| - //------------------------------------------------------------------------- |
| 124 | + //--------------------------------------------------------------------------------------- |
121 | 125 |
|
122 | 126 | /**
|
123 | 127 | * Send the given object to the default destination, converting the object
|
@@ -185,9 +189,9 @@ void convertAndSend(String destinationName, Object message, MessagePostProcessor
|
185 | 189 | throws JmsException;
|
186 | 190 |
|
187 | 191 |
|
188 |
| - //------------------------------------------------------------------------- |
| 192 | + //--------------------------------------------------------------------------------------- |
189 | 193 | // Convenience methods for receiving messages
|
190 |
| - //------------------------------------------------------------------------- |
| 194 | + //--------------------------------------------------------------------------------------- |
191 | 195 |
|
192 | 196 | /**
|
193 | 197 | * Receive a message synchronously from the default destination, but only
|
@@ -264,9 +268,9 @@ void convertAndSend(String destinationName, Object message, MessagePostProcessor
|
264 | 268 | Message receiveSelected(String destinationName, String messageSelector) throws JmsException;
|
265 | 269 |
|
266 | 270 |
|
267 |
| - //------------------------------------------------------------------------- |
| 271 | + //--------------------------------------------------------------------------------------- |
268 | 272 | // Convenience methods for receiving auto-converted messages
|
269 |
| - //------------------------------------------------------------------------- |
| 273 | + //--------------------------------------------------------------------------------------- |
270 | 274 |
|
271 | 275 | /**
|
272 | 276 | * Receive a message synchronously from the default destination, but only
|
@@ -349,9 +353,54 @@ void convertAndSend(String destinationName, Object message, MessagePostProcessor
|
349 | 353 | Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException;
|
350 | 354 |
|
351 | 355 |
|
352 |
| - //------------------------------------------------------------------------- |
| 356 | + //--------------------------------------------------------------------------------------- |
| 357 | + // Convenience methods for sending messages to and receiving the reply from a destination |
| 358 | + //--------------------------------------------------------------------------------------- |
| 359 | + |
| 360 | + /** |
| 361 | + * Send a request message and receive the reply from a default destination. The |
| 362 | + * {@link MessageCreator} callback creates the message given a Session. A temporary |
| 363 | + * queue is created as part of this operation and is set in the {@code JMSReplyTO} |
| 364 | + * header of the message. |
| 365 | + * <p>This will only work with a default destination specified! |
| 366 | + * @param messageCreator callback to create a request message |
| 367 | + * @return the reply, possibly {@code null} if the message could not be received, |
| 368 | + * for example due to a timeout |
| 369 | + * @throws JmsException checked JMSException converted to unchecked |
| 370 | + */ |
| 371 | + Message sendAndReceive(MessageCreator messageCreator) throws JmsException; |
| 372 | + |
| 373 | + /** |
| 374 | + * Send a message and receive the reply from the specified destination. The |
| 375 | + * {@link MessageCreator} callback creates the message given a Session. A temporary |
| 376 | + * queue is created as part of this operation and is set in the {@code JMSReplyTO} |
| 377 | + * header of the message. |
| 378 | + * @param destination the destination to send this message to |
| 379 | + * @param messageCreator callback to create a message |
| 380 | + * @return the reply, possibly {@code null} if the message could not be received, |
| 381 | + * for example due to a timeout |
| 382 | + * @throws JmsException checked JMSException converted to unchecked |
| 383 | + */ |
| 384 | + Message sendAndReceive(Destination destination, MessageCreator messageCreator) throws JmsException; |
| 385 | + |
| 386 | + /** |
| 387 | + * Send a message and receive the reply from the specified destination. The |
| 388 | + * {@link MessageCreator} callback creates the message given a Session. A temporary |
| 389 | + * queue is created as part of this operation and is set in the {@code JMSReplyTO} |
| 390 | + * header of the message. |
| 391 | + * @param destinationName the name of the destination to send this message to |
| 392 | + * (to be resolved to an actual destination by a DestinationResolver) |
| 393 | + * @param messageCreator callback to create a message |
| 394 | + * @return the reply, possibly {@code null} if the message could not be received, |
| 395 | + * for example due to a timeout |
| 396 | + * @throws JmsException checked JMSException converted to unchecked |
| 397 | + */ |
| 398 | + Message sendAndReceive(String destinationName, MessageCreator messageCreator) throws JmsException; |
| 399 | + |
| 400 | + |
| 401 | + //--------------------------------------------------------------------------------------- |
353 | 402 | // Convenience methods for browsing messages
|
354 |
| - //------------------------------------------------------------------------- |
| 403 | + //--------------------------------------------------------------------------------------- |
355 | 404 |
|
356 | 405 | /**
|
357 | 406 | * Browse messages in the default JMS queue. The callback gives access to the JMS
|
|
0 commit comments