From be4329545a1e7fd336a7dc3c5ef70cd9a125912a Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 17 Jun 2015 17:43:27 +0200 Subject: [PATCH] Update doc for JmsResponse Issue: SPR-13133 --- src/asciidoc/integration.adoc | 26 +++++++++++++++++++++++--- src/asciidoc/whats-new.adoc | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/asciidoc/integration.adoc b/src/asciidoc/integration.adoc index af1707bd783..89931ef3dd5 100644 --- a/src/asciidoc/integration.adoc +++ b/src/asciidoc/integration.adoc @@ -2739,8 +2739,8 @@ annotate the payload with `@Valid` and configure the necessary validator as foll } ---- -[[jms-annotated-reply]] -==== Reply management +[[jms-annotated-response]] +==== Response management The existing support in <> already allows your method to have a non-`void` return type. When that's the case, the result of @@ -2750,7 +2750,7 @@ the listener. That default destination can now be set using the `@SendTo` annota messaging abstraction. Assuming our `processOrder` method should now return an `OrderStatus`, it is possible to write it -as follow to automatically send a reply: +as follow to automatically send a response: [source,java,indent=0] [subs="verbatim,quotes"] @@ -2780,6 +2780,26 @@ If you need to set additional headers in a transport-independent manner, you cou } ---- +If you need to compute the response destination at runtime, you can encapsulate your response +in a `JmsResponse` instance that also provides the destination to use at runtime. The previous +example can be rewritten as follows: + +[source,java,indent=0] +[subs="verbatim,quotes"] +---- + @JmsListener(destination = "myDestination") + public JmsResponse> processOrder(Order order) { + // order processing + Message response = MessageBuilder + .withPayload(status) + .setHeader("code", 1234) + .build(); + return JmsResponse.forQueue(response, "status"); + } +---- + + + [[jms-namespace]] === JMS Namespace Support Spring provides an XML namespace for simplifying JMS configuration. To use the JMS diff --git a/src/asciidoc/whats-new.adoc b/src/asciidoc/whats-new.adoc index 4f81f5c5306..df74a41c63e 100644 --- a/src/asciidoc/whats-new.adoc +++ b/src/asciidoc/whats-new.adoc @@ -486,6 +486,7 @@ public @interface MyTestConfig { * The `autoStartup` attribute can be controlled via `JmsListenerContainerFactory`. * The type of the reply `Destination` can now be configured per listener container. * The value of the `@SendTo` annotation can now use a SpEL expression. +* The response destination can be <> === Web Improvements