diff --git a/docs/src/reference/docbook/aggregator.xml b/docs/src/reference/docbook/aggregator.xml index e5a271db52..7d0bd2bde2 100644 --- a/docs/src/reference/docbook/aggregator.xml +++ b/docs/src/reference/docbook/aggregator.xml @@ -287,15 +287,14 @@ -
- Configuring Aggregator - -
- Configuring an Aggregator with XML +
+ Configuring Aggregator +
+ Configuring an Aggregator with XML - Spring Integration supports the configuration of an aggregator via - XML through the <aggregator/> element. Below you can see an example - of an aggregator. + Spring Integration supports the configuration of an aggregator via + XML through the <aggregator/> element. Below you can see an example + of an aggregator. diff --git a/docs/src/reference/docbook/configuration.xml b/docs/src/reference/docbook/configuration.xml index c70facec1e..ac6a5be5a4 100644 --- a/docs/src/reference/docbook/configuration.xml +++ b/docs/src/reference/docbook/configuration.xml @@ -187,14 +187,18 @@
Annotation Support - In addition to the XML namespace support for configuring Message Endpoints, it is also possible to use - annotations. First, Spring Integration provides the class-level @MessageEndpoint - as a stereotype annotation meaning that is itself annotated with Spring's @Component - annotation and therefore is recognized automatically as a bean definition when using Spring component-scanning. + In addition to the XML namespace support for configuring Message Endpoints, + it is also possible to use annotations. First, Spring Integration provides + the class-level @MessageEndpoint as a + stereotype annotation, meaning that it is itself + annotated with Spring's @Component annotation + and is therefore recognized automatically as a bean definition when using + Spring component-scanning. - Even more importantly are the various Method-level annotations that indicate the annotated method is capable of - handling a message. The following example demonstrates both: + Even more important are the various method-level annotations that indicate + the annotated method is capable of handling a message. The following example + demonstrates both: @MessageEndpoint public class FooService { @@ -205,19 +209,32 @@ public class FooService { } - Exactly what it means for the method to "handle" the Message depends on the particular annotation. The following - are available with Spring Integration, and the behavior of each is described in its own chapter or section within - this reference: @Transformer, @Router, @Splitter, @Aggregator, @ServiceActivator, and @ChannelAdapter. + Exactly what it means for the method to "handle" the Message depends on the + particular annotation. The following annotations are available in Spring Integration: + + @Aggregator + @ChannelAdapter + @Filter + @Router + @ServiceActivator + @Splitter + @Transformer + + The behavior of each is described in its own chapter or section within + this reference. - The @MessageEndpoint is not required if using XML configuration in combination with annotations. If you want to - configure a POJO reference from the "ref" attribute of a <service-activator/> element, it is sufficient to - provide the method-level annotations. In that case, the annotation prevents ambiguity even when no "method" - attribute exists on the <service-activator/> element. + If you are using XML configuration in combination with annotations, the + @MessageEndpoint annotation is not required. + If you want to configure a POJO reference from the "ref" attribute of a + <service-activator/> element, it is sufficient to provide the + method-level annotations. In that case, the annotation prevents ambiguity + even when no "method" attribute exists on the <service-activator/> element. - In most cases, the annotated handler method should not require the Message type as its - parameter. Instead, the method parameter type can match the message's payload type. + In most cases, the annotated handler method should not require the + Message type as its parameter. Instead, the method + parameter type can match the message's payload type. public class FooService { @ServiceActivator diff --git a/docs/src/reference/docbook/filter.xml b/docs/src/reference/docbook/filter.xml index ee8824b98c..3d126f15e8 100644 --- a/docs/src/reference/docbook/filter.xml +++ b/docs/src/reference/docbook/filter.xml @@ -30,8 +30,11 @@ In combination with the namespace and SpEL, very powerful filters can be configured with very little java code.
-
+
Configuring Filter +
+ Configuring a Filter with XML + The <filter> element is used to create a Message-selecting endpoint. In addition to "input-channel and output-channel attributes, it requires a ref. The ref may point to a @@ -57,6 +60,8 @@ throw-exception-on-rejection attribute to true: ]]> + + If you want rejected messages to be routed to a specific channel, provide that reference as the discard-channel: ]]> @@ -85,9 +90,9 @@ With the introduction of SpEL support, Spring Integration added the expression attribute to the filter element. It can be used to avoid Java entirely for simple filters. - - ]]> - + ]]> + + The string passed as the expression attribute will be evaluated as a SpEL expression with the Message available in the evaluation context. If it is necessary to include the result of an expression in the scope of the application context you can use the @@ -95,9 +100,10 @@ SpEL reference documentation . - - ]]> - + ]]> + + If the Expression itself needs to be dynamic, then an 'expression' sub-element may be used. That provides a level of indirection for resolving the Expression by its key from an ExpressionSource. That is a strategy interface that you can implement directly, or you can rely upon a version available in Spring Integration that loads Expressions from @@ -105,32 +111,61 @@ the following configuration sample where the Expression could be reloaded within one minute if the underlying file had been modified. If the ExpressionSource bean is named "expressionSource", then it is not necessary to provide the source attribute on the <expression> element, but in this case it's shown for completeness. - - + + class="org.springframework.integration.expression.ReloadableResourceBundleExpressionSource"> ]]> - + + Then, the 'config/integration/expressions.properties' file (or any more specific version with a locale extension to be resolved in the typical way that resource-bundles are loaded) would contain a key/value pair: - - 100 -]]> + 100]]> - All of these examples that use expression as an attribute or sub-element can also be applied within - transformer, router, splitter, service-activator, and header-enricher elements. Of course, the semantics/role - of the given component type would affect the interpretation of the evaluation result in the same way that the - return value of a method-invocation would be interpreted. For example, an expression can return Strings that are - to be treated as Message Channel names by a router component. However, the underlying functionality of evaluating - the expression against the Message as the root object, and resolving bean names if prefixed with '@' is consistent + All of these examples that use expression as an attribute + or sub-element can also be applied within transformer, router, splitter, + service-activator, and header-enricher elements. Of course, the semantics/role + of the given component type would affect the interpretation of the evaluation + result in the same way that the return value of a method-invocation would + be interpreted. For example, an expression can return Strings that are to + be treated as Message Channel names by a router component. However, the + underlying functionality of evaluating the expression against the Message + as the root object, and resolving bean names if prefixed with '@' is consistent across all of the core EIP components within Spring Integration. +
+
+ Configuring a Filter with Annotations + A filter configured using annotations would look like this. + + + + + + An annotation indicating that this method shall be used as a + filter. Must be specified if this class will be used as a filter. + + + + All of the configuration options provided by the xml element are + also available for the @Filter annotation. + + The filter can be either referenced explicitly from XML or, if + the @MessageEndpoint annotation is defined + on the class, detected automatically through classpath scanning. +