GH-9706: Allow collection of payloads as an aggregator result
Fixes: https://github.com/spring-projects/spring-integration/issues/9706 Previously, if a `MessageGroupProcessor` returns a collection of payloads, the `AbstractCorrelatingMessageHandler` has failed with the `IllegalArgumentException` stating that only collection of messages is possible. From now on such a restriction is eliminated and returned collection of payloads is emitted as a single reply message from the aggregator. * Add `AbstractCorrelatingMessageHandler.isResultCollectionOfMessages()` to return `true` only if result is a collection of messages, treating them as a "partial sequence". * Deprecate `AbstractCorrelatingMessageHandler.verifyResultCollectionConsistsOfMessages()` since it is out of use now.
This commit is contained in:
@@ -144,6 +144,10 @@ Starting with version 6.0, the splitting behaviour, described above, works only
|
||||
Otherwise, with any other `MessageGroupProcessor` implementation that returns a `Collection<Message>`, only a single reply message is emitted with the whole collection of messages as its payload.
|
||||
Such logic is dictated by the canonical purpose of an aggregator - collect request messages by some key and produce a single grouped message.
|
||||
|
||||
Prior to version 6.5, if a `MessageGroupProcessor` (usually lambda from DSL) returns a collection of payloads, the `AbstractCorrelatingMessageHandler` has failed with the `IllegalArgumentException` stating that only collection of messages is possible.
|
||||
From now on such a restriction is eliminated and returned collection of payloads is emitted as a single reply message from the aggregator with just headers from the last request message.
|
||||
If headers aggregation is required alongside with a collection of payloads, an `AbstractAggregatingMessageGroupProcessor` implementations are recommended to be used instead of plain `MessageGroupProcessor` functional interface.
|
||||
|
||||
[[releasestrategy]]
|
||||
=== `ReleaseStrategy`
|
||||
|
||||
|
||||
@@ -21,3 +21,8 @@ The deprecated previously usage of `org.springframework.util.concurrent.Listenab
|
||||
The previously deprecated SpEL-based Control Bus components have been removed in favor of functionality around `ControlBusCommandRegistry`.
|
||||
The `<control-bus use-registry="">` attribute is deprecated now without replacement since only `ControlBusCommandRegistry` functionality is available.
|
||||
The Java DSL `controlBusOnRegistry()` operator is deprecated in favor of restored `controlBus()` which is fully based now on the `ControlBusCommandRegistry`.
|
||||
See xref:control-bus.adoc[Control Bus] for more information.
|
||||
|
||||
The `AbstractCorrelatingMessageHandler` does not throw an `IllegalArgumentException` for the collection of payloads as a result of the `MessageGroupProcessor`.
|
||||
Instead, such a collection is wrapped into a single reply message.
|
||||
See xref:aggregator.adoc[Aggregator] for more information.
|
||||
Reference in New Issue
Block a user