GH-932 Fix registration of AWSTypesMessageConverter for functional spring applications
Resolves #932
This commit is contained in:
@@ -96,6 +96,7 @@ public class FunctionalSpringApplication
|
||||
Assert.isInstanceOf(GenericApplicationContext.class, context,
|
||||
"ApplicationContext must be an instanceof GenericApplicationContext");
|
||||
for (Object source : getAllSources()) {
|
||||
System.out.println("======> SOURCE: " + source);
|
||||
Class<?> type = null;
|
||||
Object handler = null;
|
||||
if (source instanceof String) {
|
||||
|
||||
@@ -926,6 +926,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
||||
if (inputValue instanceof Message && !this.isInputTypeMessage()) {
|
||||
inputValue = ((Message) inputValue).getPayload();
|
||||
}
|
||||
System.out.println("Invoking function: " + this + "with input type: " + this.getInputType());
|
||||
Object result = ((Function) this.target).apply(inputValue);
|
||||
|
||||
if (result instanceof Publisher && functionInvocationHelper != null) {
|
||||
@@ -1096,7 +1097,8 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
||||
: convertedInput;
|
||||
}
|
||||
if (convertedInput != null && logger.isDebugEnabled()) {
|
||||
logger.debug("Converted Message: " + input + " to: " + convertedInput);
|
||||
logger.debug("Converted Message: " + input + " to: " +
|
||||
(convertedInput instanceof OriginalMessageHolder ? ((OriginalMessageHolder) convertedInput).value.getClass() : convertedInput));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -176,6 +176,7 @@ public class ContextFunctionCatalogInitializer implements ApplicationContextInit
|
||||
List<MessageConverter> messageConverters = new ArrayList<>();
|
||||
JsonMapper jsonMapper = this.context.getBean(JsonMapper.class);
|
||||
|
||||
messageConverters.addAll(context.getBeansOfType(MessageConverter.class).values());
|
||||
messageConverters.add(new JsonMessageConverter(jsonMapper));
|
||||
messageConverters.add(new ByteArrayMessageConverter());
|
||||
messageConverters.add(new StringMessageConverter());
|
||||
|
||||
@@ -92,7 +92,13 @@ public class JsonMessageConverter extends AbstractMessageConverter {
|
||||
if (payload instanceof byte[]) {
|
||||
payload = new String((byte[]) payload, StandardCharsets.UTF_8);
|
||||
}
|
||||
logger.warn("Failed to convert value: " + payload, e);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to convert value: " + payload + " to: " + targetClass, e);
|
||||
}
|
||||
else {
|
||||
logger.warn("Failed to convert value: " + payload + " to: " + targetClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user