-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Consider adding request attribute support for webclient in webflux integration #3936
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
Comments
For more context: https://stackoverflow.com/questions/74215136/how-to-add-request-attribute-through-spring-webflux-integration-for-outbound-gat. @saxenaj , I didn't look in details what is to deal with request attributes, but probably they can be resolved by SpEL expression against request message, since it really sounds like request-specific feature. Thank you! |
Thanks @artembilan for prompt response. I will be happy to contribute. Here user can pass a map which contain key-value pair which needs to be set in request attribute in the outbound configuration xml. In WebFluxRequestExecutingHandler , i will be evaluating using StandardEvaluationContext which is already present in application context and generates a map with key value pairs and eventually this map will be set as request attributes. |
Yep! Sounds good. With only one remark that this must not be a map of expression, but more like a single expression which has to be evaluate into a |
Ok!! I believe this is what you are referring to with VariablesExpression. In this example,i see that SupplierExpression is provided with null. In webflux outbound scenario, are we expecting user to provide the supplierExpression. Also can you pls give me an example of single expression(probably with String Key and custom object as Value) which will evaluate to Map<String, Object> using SupplierExpression. I was trying to find in Spring integration code and didnt find any. |
No-no. don't jump too deep in details of that |
Hi @artembilan - I have went through the contribution guide and created a PR for this issue #3950. |
Expected Behavior
It seems like webflux integration doesnt support for request attributes.
Current Behavior
Currently below code line up creating new DefaultRequestBodyUriSpec on every call
WebFluxRequestExecutingMessageHandler
Even if i pass custom webclient which has all the attributes added, above implementation ignores existing attributes in webclient.
Context
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.
There is a workaround to pass required information in headers but headers only support String key value pair. It become difficult to pass information in format of String as key and user defined object as value.
As a workaround,i end up creating my own requestexecutingmessagehandler by extending WebFluxRequestExecutingMessageHandler and adding required attributes.
The text was updated successfully, but these errors were encountered: