GH-3280: NullChannel as reply for void gateways (#3292)

* GH-3280: NullChannel as reply for void gateways

Fixes https://github.com/spring-projects/spring-integration/issues/3280

To properly support a one-way gateway (`void` return type), it is
better to ignore any possible replies from downstream instead of
unexpected `no output-channel or replyChannel header available`
error

* Populate a `nullChannel` into a `replyChannel` header
for `void` gateway methods when `replyChannel` is not set explicitly
* Remove redundant `GatewayProxyFactoryBean.PARSER` in favor of
similar `EXPRESSION_PARSER` in the super class
* Test and document the feature

* * Fix language in the `whats-new.adoc`

Co-authored-by: Gary Russell <grussell@vmware.com>

* * Fix language in gateway.adoc

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
Artem Bilan
2020-05-27 16:10:05 -04:00
committed by GitHub
parent e98169146b
commit b8e2dfe4e1
4 changed files with 59 additions and 12 deletions

View File

@@ -82,6 +82,9 @@ The gateway creates a bridge from it to the temporary, anonymous reply channel t
You might also want to explicitly provide a reply channel for monitoring or auditing through an interceptor (for example, <<./channel.adoc#channel-wiretap,wiretap>>).
To configure a channel interceptor, you need a named channel.
NOTE: Starting with version 5.4, when gateway method return type is `void`, the framework populates a `replyChannel` header as a `nullChannel` bean reference if such a header is not provided explicitly.
This allows any possible reply from the downstream flow to be discarded, meeting the one-way gateway contract.
[[gateway-configuration-annotations]]
==== Gateway Configuration with Annotations and XML

View File

@@ -12,3 +12,11 @@ If you are interested in the changes and features that were introduced in earlie
If you are interested in more details, see the Issue Tracker tickets that were resolved as part of the 5.4 development process.
[[x5.4-new-components]]
=== New Components
[[x5.4-general]]
=== General Changes
The one-way messaging gateway (the `void` method return type) now sets a `nullChannel` explicitly into the `replyChannel` header to ignore any possible downstream replies.
See <<./gateway.adoc#gateway-default-reply-channel,Setting the Default Reply Channel>> for more information.