You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH-2967: Fix ScatterGatherH for headers copy (#2968)
* GH-2967: Fix ScatterGatherH for headers copy
Fixes#2967
The `ChannelInterceptor` is added into the `this.gatherChannel` on each
request message making a subsequent requests for scatter-gather as
halting on reply.
* Add an interceptor into an injected `this.gatherChannel` only once
during `ScatterGatherHandler` initialization
* Introduce `ORIGINAL_REPLY_CHANNEL` and `ORIGINAL_ERROR_CHANNEL`
headers to carry a request reply and error channels from headers
* Populate `REPLY_CHANNEL` and `ERROR_CHANNEL` headers back before
sending scattering replies into gatherer
* Transfer a `GATHER_RESULT_CHANNEL` header now directly from the scatter
message to make it available in the reply from the gatherer
* Add note about those headers in the `scatter-gather.adoc`
* Modify `ScatterGatherTests` to be sure that `ScatterGatherHandler`
works for several requests
**Cherry-pick to 5.1.x**
* * Fix language in doc
Copy file name to clipboardExpand all lines: spring-integration-core/src/main/java/org/springframework/integration/scattergather/ScatterGatherHandler.java
+37-37
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,10 @@ public class ScatterGatherHandler extends AbstractReplyProducingMessageHandler i
Copy file name to clipboardExpand all lines: spring-integration-core/src/test/java/org/springframework/integration/scattergather/config/ScatterGatherTests-context.xml
Copy file name to clipboardExpand all lines: spring-integration-core/src/test/java/org/springframework/integration/scattergather/config/ScatterGatherTests.java
Copy file name to clipboardExpand all lines: src/reference/asciidoc/scatter-gather.adoc
+2
Original file line number
Diff line number
Diff line change
@@ -209,5 +209,7 @@ Such an exception `payload` can be filtered out in the `MessageGroupProcessor` o
209
209
210
210
NOTE: Before sending scattering results to the gatherer, `ScatterGatherHandler` reinstates the request message headers, including reply and error channels if any.
211
211
This way errors from the `AggregatingMessageHandler` are going to be propagated to the caller, even if an async hand off is applied in scatter recipient subflows.
212
+
For successful operation, a `gatherResultChannel`, `originalReplyChannel` and `originalErrorChannel` headers must be transferred back to replies from scatter recipient subflows.
212
213
In this case a reasonable, finite `gatherTimeout` must be configured for the `ScatterGatherHandler`.
213
214
Otherwise it is going to be blocked waiting for a reply from the gatherer forever, by default.
0 commit comments