Skip to content

GH-2967: Fix ScatterGatherH for headers copy #2968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2019

Conversation

artembilan
Copy link
Member

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

Fixes spring-projects#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**
@@ -209,5 +209,7 @@ Such an exception `payload` can be filtered out in the `MessageGroupProcessor` o

NOTE: Before sending scattering results to the gatherer, `ScatterGatherHandler` reinstates the request message headers, including reply and error channels if any.
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.
To make it working properly, a `gatherResultChannel`, `originalReplyChannel` and `originalErrorChannel` headers must be transferred back to replies from scatter recipient subflows.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/To make it working properly,/For successful operation,/

@garyrussell garyrussell merged commit d79c06a into spring-projects:master Jun 19, 2019
garyrussell pushed a commit that referenced this pull request Jun 19, 2019
* 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
@garyrussell
Copy link
Contributor

And cherry-picked as 46ae25d after resolving conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ScatterGatherHandler getting stuck after first message
2 participants