|
28 | 28 |
|
29 | 29 | /**
|
30 | 30 | * A fluent {@code JmsClient} with common send and receive operations against a JMS
|
31 |
| - * destination. This is effectively an alternative to {@link JmsMessagingTemplate}, |
32 |
| - * also delegating to Spring's {@link JmsTemplate} for performing actual operations. |
| 31 | + * destination, dealing with Spring's common {@link Message} or with payload values. |
| 32 | + * This is effectively an alternative to {@link JmsMessagingTemplate}, also |
| 33 | + * delegating to Spring's {@link JmsTemplate} for performing actual operations. |
33 | 34 | *
|
34 | 35 | * <p>Note: Operations in this interface throw {@link MessagingException} instead of
|
35 | 36 | * the JMS-specific {@link org.springframework.jms.JmsException}, aligning with the
|
36 | 37 | * {@code spring-messaging} module and its other client operation handles.
|
| 38 | + * Message conversion is preferably done through the common {@link MessageConverter} |
| 39 | + * but can also be customized at the {@link JmsTemplate#setMessageConverter} level. |
37 | 40 | *
|
38 | 41 | * <p>This client provides reusable operation handles which can be configured with
|
39 | 42 | * custom QoS settings. Note that any use of such explicit settings will override
|
40 | 43 | * administrative provider settings (see {@link JmsTemplate#setExplicitQosEnabled}).
|
41 | 44 | *
|
| 45 | + * <p>An example for sending a converted payload to a queue: |
| 46 | + * <pre class="code"> |
| 47 | + * client.destination("myQueue") |
| 48 | + * .withTimeToLive(1000) |
| 49 | + * .send("myPayload"); // optionally with a headers Map next to the payload |
| 50 | + * </pre> |
| 51 | + * |
| 52 | + * <p>An example for receiving a converted payload from a queue: |
| 53 | + * <pre class="code"> |
| 54 | + * Optional<String> payload = client.destination("myQueue") |
| 55 | + * .withReceiveTimeout(1000) |
| 56 | + * .receive(String.class); |
| 57 | + * </pre> |
| 58 | + * |
| 59 | + * <p>An example for sending a message with a payload to a queue: |
| 60 | + * <pre class="code"> |
| 61 | + * Message<?> message = |
| 62 | + * MessageBuilder.withPayload("myPayload").build(); // optionally with headers |
| 63 | + * client.destination("myQueue") |
| 64 | + * .withTimeToLive(1000) |
| 65 | + * .send(message); |
| 66 | + * </pre> |
| 67 | + * |
| 68 | + * <p>An example for receiving a message with a payload from a queue: |
| 69 | + * <pre class="code"> |
| 70 | + * Optional<Message<?>> message = client.destination("myQueue") |
| 71 | + * .withReceiveTimeout(1000) |
| 72 | + * .receive(); |
| 73 | + * </pre> |
| 74 | + * |
42 | 75 | * @author Juergen Hoeller
|
43 | 76 | * @since 7.0
|
44 | 77 | * @see JmsTemplate
|
45 | 78 | * @see JmsMessagingTemplate
|
| 79 | + * @see org.springframework.messaging.support.MessageBuilder |
46 | 80 | */
|
47 | 81 | interface JmsClient {
|
48 | 82 |
|
|
0 commit comments