GH-588 Fix dropped headers during input conversion

This addresses the issue of dropped Message headers in the event where input is a Message but input conversion is not necessary
while Message contains headers that require explicit propagation (e.g., scf-sink-url, scf-func-name)

Resolves #588
This commit is contained in:
Oleg Zhurakousky
2020-09-18 18:46:33 +02:00
parent 6c6f98fa1d
commit 186c0b7a26
2 changed files with 31 additions and 3 deletions

View File

@@ -777,8 +777,12 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
}
Publisher<?> result = publisher instanceof Mono
? Mono.from(publisher).map(value -> this.convertInputValueIfNecessary(value, type))
: Flux.from(publisher).map(value -> this.convertInputValueIfNecessary(value, type));
? Mono.from(publisher).map(value -> this.convertInputValueIfNecessary(value, type)).doOnError(v -> {
v.printStackTrace();
})
: Flux.from(publisher).map(value -> this.convertInputValueIfNecessary(value, type)).doOnError(v -> {
v.printStackTrace();
});
return result;
}
@@ -834,7 +838,9 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
if (this.payloadIsSpecialType(((Message<?>) value).getPayload())) {
return null;
}
convertedValue = ((Message<?>) convertedValue).getPayload();
if (!((Message<?>) convertedValue).getHeaders().containsKey("scf-sink-url")) {
convertedValue = ((Message<?>) convertedValue).getPayload();
}
}
}
else if (rawType instanceof Class<?>) { // see AWS adapter with WildardTypeImpl and Azure with Voids