Fix LambdaMessageProcessor for Map payload
JIRA: https://jira.spring.io/browse/INT-4478 When we use a `GenericHandler` and an incoming payload is a `Map`, we copy it into both arguments into the `Object` for the payload and `Map` for the headers. This way we lose headers in the target lambda * Check a size of arguments on the target lambda and don't set a payload into the `Map` argument if we have more than 1 arguments **Cherry-pick to 5.0.x**
This commit is contained in:
committed by
Gary Russell
parent
abfda64798
commit
4d2e00d6c8
@@ -100,7 +100,7 @@ public class LambdaMessageProcessor implements MessageProcessor<Object>, BeanFac
|
||||
args[i] = message;
|
||||
}
|
||||
else if (Map.class.isAssignableFrom(parameterType)) {
|
||||
if (message.getPayload() instanceof Map) {
|
||||
if (message.getPayload() instanceof Map && this.parameterTypes.length == 1) {
|
||||
args[i] = message.getPayload();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -299,8 +299,10 @@ public class WebFluxDslTests {
|
||||
public IntegrationFlow sseFlow() {
|
||||
return IntegrationFlows
|
||||
.from(WebFlux.inboundGateway("/sse")
|
||||
.requestMapping(m -> m.produces(MediaType.TEXT_EVENT_STREAM_VALUE)))
|
||||
.handle((p, h) -> Flux.just("foo", "bar", "baz"))
|
||||
.requestMapping(m -> m.produces(MediaType.TEXT_EVENT_STREAM_VALUE))
|
||||
.mappedResponseHeaders("*"))
|
||||
.enrichHeaders(Collections.singletonMap("aHeader", new String[] { "foo", "bar", "baz" }))
|
||||
.handle((p, h) -> Flux.fromArray((String[]) h.get("aHeader")))
|
||||
.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user