GH-3936: WebFluxMH: Add request attribute support

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

I am passing request attributes which is getting used in exchangefilter to influence the flow. This request attribute is of type String as Key and Value as a user defined object.

My expectation is to pass this information in request attributes so that it will eventually available in exchangefilter for further processing but i dont find a way to pass these request attribute in webflux integration.

* Add webclient request attributes into `WebFluxRequestExecutingMessageHandler`
* Improve code style and docs
This commit is contained in:
jatinsaxena
2022-11-16 00:05:47 -05:00
committed by abilan
parent 91007e6745
commit ddddd1d0a5
8 changed files with 164 additions and 12 deletions

View File

@@ -319,3 +319,11 @@ See <<./http.adoc#http-outbound,HTTP Outbound Components>> for more possible con
Since WebFlux components are fully based on the HTTP protocol, there is no difference in the HTTP headers mapping.
See <<./http.adoc#http-header-mapping,HTTP Header Mappings>> for more possible options and components to use for mapping headers.
[[webflux-request-attributes]]
=== WebFlux Request Attributes
Starting with version 6.0, the `WebFluxRequestExecutingMessageHandler` can be configured to evaluate request attributes via `setAttributeVariablesExpression()`.
This SpEL expression must be evaluated in `Map`.
Such a map is then propagated to the `WebClient.RequestBodySpec.attributes(Consumer<Map<String, Object>> attributesConsumer)` HTTP request configuration callback.
This will be helpful if an information in a form of key-value object needs to be passed from `Message` to request and downstream filter will get access to these attributes for further processing.

View File

@@ -202,3 +202,13 @@ See <<./jms.adoc#jms,JMS Support>> for more information.
The `ChannelSecurityInterceptor` and its annotation `@SecuredChannel` and XML `<secured-channels>` configurations have been deprecated in favor of `AuthorizationChannelInterceptor`.
See <<./security.adoc#security,Security Support>> for more information.
[[x6.0-webflux]]
=== Webflux Request Attributes Support
Webclient Request attributes support has been added for `WebFluxRequestExecutingMessageHandler`.
See <<./webflux.adoc#webflux-request-attributes,WebFlux Request Attributes>> for more information.