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
Fixes#2744
When we get scattering results, there is no reason to keep internal
headers any more.
* Fix `ScatterGatherHandler` to modify scattering result messages to
reinstate headers from original request message.
This way we are able to re-throw an exception from the gatherer to
the caller.
* Fix typos and language in Docs
Copy file name to clipboardExpand all lines: spring-integration-core/src/main/java/org/springframework/integration/scattergather/ScatterGatherHandler.java
Copy file name to clipboardExpand all lines: spring-integration-jmx/src/test/java/org/springframework/integration/monitor/ScatterGatherHandlerIntegrationTests.java
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2014-2015 the original author or authors.
2
+
* Copyright 2014-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
24
24
25
25
importjava.util.Arrays;
26
26
importjava.util.List;
27
-
importjava.util.concurrent.Executors;
27
+
importjava.util.concurrent.Executor;
28
28
29
29
importorg.junit.Test;
30
30
importorg.junit.runner.RunWith;
@@ -278,8 +278,8 @@ public MessageChannel gatherChannel() {
Copy file name to clipboardExpand all lines: src/reference/asciidoc/scatter-gather.adoc
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -206,3 +206,8 @@ public Message<?> processAsyncScatterError(MessagingException payload) {
206
206
To produce a proper reply, we have to copy headers (including `replyChannel` and `errorChannel`) from the `failedMessage` of the `MessagingException` that has been sent to the `scatterGatherErrorChannel` by the `MessagePublishingErrorHandler`.
207
207
This way the target exception is returned to the gatherer of the `ScatterGatherHandler` for reply messages group completion.
208
208
Such an exception `payload` can be filtered out in the `MessageGroupProcessor` of the gatherer or processed other way downstream, after the scatter-gather endpoint.
209
+
210
+
NOTE: Before sending scattering results to the gatherer, `ScatterGatherHandler` reinstates the request message headers, including reply and error channels if any.
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
+
In this case a reasonable, finite `gatherTimeout` must be configured for the `ScatterGatherHandler`.
213
+
Otherwise it is going to be blocked waiting for a reply from the gatherer forever, by default.
0 commit comments