diff --git a/spring-integration-reference/src/configuration.xml b/spring-integration-reference/src/configuration.xml
index e365dce1d6..7f829076ed 100644
--- a/spring-integration-reference/src/configuration.xml
+++ b/spring-integration-reference/src/configuration.xml
@@ -435,20 +435,38 @@ public class FooService {
public void bar(Foo foo) {
...
}
+}
+
+
+ When the method parameter should be mapped from a value in the MessageHeader, another
+ option is to use the @HeaderAttribute and/or
+ @HeaderProperty parameter annotations.
+ @MessageEndpoint(input="fooChannel")
+public class FooService {
+
+ @Handler
+ pub lic void bar(@HeaderAttribute("fooAttrib") Foo foo) {
+ ...
+ }
}
As described in the previous section, when the handler method returns a non-null value, the endpoint will
attempt to send a reply. This is consistent across both configuration options (namespace and annotations) in that
- the message header's 'replyChannelName' property will be used if available, and the endpoint's default output is
- the fallback. To configure the default output for an annotation-driven endpoint, provide the 'output'
+ the the endpoint's output channel will be used if available, and the message header's 'returnAddress' value will be
+ the fallback. To configure the output channel for an annotation-driven endpoint, provide the 'output'
attribute on the @MessageEndpoint.
@MessageEndpoint(input="exampleChannel", output="replyChannel")
Just as the 'schedule' sub-element and its 'period' attribute can be provided for a namespace-based
- endpoint, the 'pollPeriod' attribute can be provided on the @MessageEndpoint.
- @MessageEndpoint(input="exampleChannel", pollPeriod=3000)
+ endpoint, the @Polled annotation can be provided with the
+ @MessageEndpoint annotation.
+ @MessageEndpoint(input="exampleChannel")
+@Polled(period=3000)
+public class FooService {
+ ...
+}
Likewise, @Concurrency provides an annotation-based equivalent of the
<concurrency/> element:
@MessageEndpoint(input="fooChannel")
@@ -487,20 +505,20 @@ public List<String> route(Foo payload) {...}
In addition to payload-based routing, a common requirement is to route based on metadata available within the
message header as either a property or attribute. Rather than requiring use of the
Message type as the method parameter, the @Router
- annotation may also map to either a property or attribute name.
- @Router(property="customerType")
-public String route(String customerType)
+ annotation may also use the same parameter annotations that were introduced above.
+ @Router
+public String route(@HeaderProperty("customerType") String customerType)
-@Router(attribute="orderStatus")
-public List<String> route(OrderStatus status)
+@Router
+public List<String> route(@HeaderAttribute("orderStatus") OrderStatus status)
The @Splitter annotation is also applicable to methods that expect either the
Message type or the message payload type, and the return values of the method
should be a collection of any type. If the returned values are not actual Message
- objects, then each of them will be sent as the payload of a message. The @Splitter
- annotation expects a 'channel' attribute that specifies the channel name to which those messages should be sent.
- @Splitter(channel="exampleChannel")
+ objects, then each of them will be sent as the payload of a message. Those messages will be sent to the output
+ channel as designated for the endpoint on which the @Splitter is defined.
+ @Splitter
List<LineItem> extractItems(Order order) {
return order.getItems()
}
diff --git a/spring-integration-reference/src/samples.xml b/spring-integration-reference/src/samples.xml
index 42932e391f..197baf3874 100644
--- a/spring-integration-reference/src/samples.xml
+++ b/spring-integration-reference/src/samples.xml
@@ -65,10 +65,10 @@
the @MessageEndpoint annotation. That annotation extends Spring's
"stereotype" annotations (by relying on the @Component meta-annotation), and so all classes carrying the
endpoint annotation are capable of being detected by the component-scanner.
- split(DrinkOrder order) {
return order.getDrinks();
}