INT-3583: Allow MessageGroupProcessor in Agg, XML

JIRA: https://jira.spring.io/browse/INT-3583

Previously, the `ref` or inner bean for an aggregator was wrapped
in a `MethodInvokingMessageGroupProcessor` for POJO aggregation logic.

Now, if the ref'd bean is a `MessageGroupProcessor`, it is used as the
output processor directly.

Also, the `SimpleMessageGroupProcessor` is added which simply returns the
collection of messages.

INT-3583: Polishing; PR Comments

Fix AsciiDoc

Revert `CorrelationMessageBarrier` deprecation

Fix Docs for wrong chapter link
This commit is contained in:
Gary Russell
2015-06-26 15:09:11 -04:00
committed by Artem Bilan
parent cef99f3584
commit bf8e79cb1e
15 changed files with 362 additions and 42 deletions

View File

@@ -114,6 +114,23 @@ This method will be invoked for aggregating messages as follows:
NOTE: In the interest of code simplicity, and promoting best practices such as low coupling, testability, etc., the preferred way of implementing the aggregation logic is through a POJO, and using the XML or annotation support for configuring it in the application.
If the `MessageGroupProcessor` 's `processMessageGroup` method returns a collection, it must be a collection of
`Messge<?>` s.
In this case, the messages are released individually.
Prior to _version 4.2_, it was not possible to provide a `MessageGroupProcessor` using XML configuration, only POJO
methods could be used for aggregation.
Now, if the framework detects that the referenced (or inner) bean implements `MessageProcessor`, it is used as the
aggregator's output processor.
If you wish to release a collection of objects from a custom `MessageGroupProcessor` as the payload of a message, your
class should extend `AbstractAggregatingMessageGroupProcessor` and implement `aggregatePayloads()`.
Also, since _version 4.2_, a `SimpleMessageGroupProcessor` is provided; which simply returns the collection of
messages from the group, which, as indicated above, causes the released messages to be sent individually.
This allows the aggregator to work as a message barrier where arriving messages are held until the release strategy
fires, and the group is released, as a sequence of individual messages.
===== ReleaseStrategy
The `ReleaseStrategy` interface is defined as follows:

View File

@@ -17,13 +17,13 @@ See <<mqtt>>
===== @EnableIntegration
The `@EnableIntegration` annotation has been added, to permit declaration of standard Spring Integration beans when using `@Configuration` classes.
See <<enable-integration>> for more information.
See <<annotations>> for more information.
[[x4.0-component-scan]]
===== @IntegrationComponentScan
The `@IntegrationComponentScan` annotation has been added, to permit classpath scanning for Spring Integration specific components.
See <<enable-integration>> for more information.
See <<annotations>> for more information.
[[x4.0-message-history]]
===== @EnableMessageHistory
@@ -50,19 +50,19 @@ For more information seehttp://docs.spring.io/spring-boot/docs/current/reference
===== @GlobalChannelInterceptor
As well as the `@EnableIntegration` annotation mentioned above, the `@GlobalChannelInterceptor` annotation has bean introduced.
For more information, see <<enable-integration>>.
For more information, see <<annotations>>.
[[x4.0-integration-converter]]
===== @IntegrationConverter
The `@IntegrationConverter` annotation has bean introduced, as an analogue of `<int:converter/>` component.
For more information, see <<enable-integration>>.
For more information, see <<annotations>>.
[[x4.0-enable-publisher]]
===== @EnablePublisher
The `@EnablePublisher` annotation has been added, to allow the specification of a `default-publisher-channel` for `@Publisher` annotations.
See <<enable-integration>> for more information.
See <<annotations>> for more information.
[[x4.0-redis-cms]]
===== Redis Channel Message Stores

View File

@@ -187,7 +187,7 @@ IMPORTANT: It is important to understand that filters (including patterns, regex
Any of these attributes set on the adapter are subsequently injected into the scanner.
For this reason, if you need to provide a custom scanner and you have multiple file inbound adapters in the same application context, each adapter must be provided with its own instance of the scanner, either by declaring separate beans, or declaring `scope="prototype"` on the scanner bean so that the context will create a new instance for each use.
===== Limiting Memory Consumption
==== Limiting Memory Consumption
A `HeadDirectoryScanner` can be used to limit the number of files retained in memory.
This can be useful when scanning large directories.

View File

@@ -272,7 +272,7 @@ public interface TestGateway {
----
As with the XML version, Spring Integration creates the `proxy` implementation with its messaging infrastructure, when discovering these annotations during a component scan.
To perform this scan and register the `BeanDefinition` in the application context, add the `@IntegrationComponentScan` annotation to a `@Configuration` class - see also <<enable-integration>>.
To perform this scan and register the `BeanDefinition` in the application context, add the `@IntegrationComponentScan` annotation to a `@Configuration` class - see also <<annotations>>.
[[gateway-calling-no-argument-methods]]
==== Invoking No-Argument Methods

View File

@@ -176,13 +176,23 @@ See <<gw-completable-future>> for more information.
===== MessagingGateway Annotation
The request and reply timeout properties are now `String` instead of `Long` to allow configuration with property
placeholders or SpEL. See [[messaging-gateway-annotation]].
placeholders or SpEL. See <<messaging-gateway-annotation>>.
[[x4.2-aggregator-perf]]
==== Aggregator Performance
[[x4.2-aggregator-changes]]
==== Aggregator Changes
===== Aggregator Performance
This release includes some performance improvements for aggregating components (aggregator, resequencer, etc),
by more efficiently removing messages from groups when they are released.
New methods (`removeMessagesFromGroup`) have been added to the message store.
Set the `removeBatchSize` property (default `100`) to adjust the number of messages deleted in each operation.
Currently, JDBC, Redis and MongoDB message stores support this property.
===== Output MessageGroupProcessor
When using a `ref` or innner bean for the aggregator, it is now possible to bind a `MessageGroupProcessor` directly.
In addition, a `SimpleMessageGroupProcessor` is provided that simply returns the collection of messages in the group.
When an output processor produces a collection of `Message<?>`, the aggregator releases those messages individually.
Configuring the `SimpleMessageGroupProcessor` makes the aggregator a message barrier, were messages are held up
until they all arrive, and are then released individually. See <<aggregator>> for more information.