Polish to fix build
This commit is contained in:
@@ -28,6 +28,7 @@ import reactor.core.publisher.Flux;
|
|||||||
|
|
||||||
import org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer;
|
import org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer;
|
||||||
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
|
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
|
||||||
|
import org.springframework.messaging.Message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param <E> event type
|
* @param <E> event type
|
||||||
@@ -61,6 +62,9 @@ public class SpringBootRequestHandler<E, O> extends AbstractSpringFunctionAdapte
|
|||||||
protected <T> T result(Object input, Publisher<?> output) {
|
protected <T> T result(Object input, Publisher<?> output) {
|
||||||
List<O> result = new ArrayList<>();
|
List<O> result = new ArrayList<>();
|
||||||
for (Object value : Flux.from(output).toIterable()) {
|
for (Object value : Flux.from(output).toIterable()) {
|
||||||
|
if (value instanceof Message<?> && !((FunctionInvocationWrapper) this.function()).isOutputTypeMessage()) {
|
||||||
|
value = ((Message<?>) value).getPayload();
|
||||||
|
}
|
||||||
result.add(convertOutput(value));
|
result.add(convertOutput(value));
|
||||||
}
|
}
|
||||||
if (isSingleValue(input) && result.size() == 1) {
|
if (isSingleValue(input) && result.size() == 1) {
|
||||||
|
|||||||
@@ -729,6 +729,9 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private Object convertInputIfNecessary(Object input, Type type) {
|
private Object convertInputIfNecessary(Object input, Type type) {
|
||||||
|
if (type == null) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
if (this.getRawClassFor(type) == Void.class && !(input instanceof Publisher) && !(input instanceof Message)) {
|
if (this.getRawClassFor(type) == Void.class && !(input instanceof Publisher) && !(input instanceof Message)) {
|
||||||
logger.info("Input value '" + input + "' is ignored for function '"
|
logger.info("Input value '" + input + "' is ignored for function '"
|
||||||
+ this.functionDefinition + "' since it's input type is Void and as such it is treated as Supplier.");
|
+ this.functionDefinition + "' since it's input type is Void and as such it is treated as Supplier.");
|
||||||
|
|||||||
@@ -95,10 +95,11 @@ public class ContextFunctionCatalogAutoConfiguration {
|
|||||||
mcList = mcList.stream()
|
mcList = mcList.stream()
|
||||||
.filter(c -> isConverterEligible(c))
|
.filter(c -> isConverterEligible(c))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
mcList.add(new StringMessageConverter());
|
|
||||||
mcList.add(new PrimitiveTypesFromStringMessageConverter(conversionService));
|
|
||||||
mcList.add(new JsonMessageConverter(jsonMapper));
|
mcList.add(new JsonMessageConverter(jsonMapper));
|
||||||
mcList.add(new ByteArrayMessageConverter());
|
mcList.add(new ByteArrayMessageConverter());
|
||||||
|
mcList.add(new StringMessageConverter());
|
||||||
|
mcList.add(new PrimitiveTypesFromStringMessageConverter(conversionService));
|
||||||
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(mcList)) {
|
if (!CollectionUtils.isEmpty(mcList)) {
|
||||||
|
|||||||
@@ -170,10 +170,10 @@ public class ContextFunctionCatalogInitializer implements ApplicationContextInit
|
|||||||
List<MessageConverter> messageConverters = new ArrayList<>();
|
List<MessageConverter> messageConverters = new ArrayList<>();
|
||||||
JsonMapper jsonMapper = this.context.getBean(JsonMapper.class);
|
JsonMapper jsonMapper = this.context.getBean(JsonMapper.class);
|
||||||
|
|
||||||
messageConverters.add(new StringMessageConverter());
|
|
||||||
messageConverters.add(new PrimitiveTypesFromStringMessageConverter(new DefaultConversionService()));
|
|
||||||
messageConverters.add(new JsonMessageConverter(jsonMapper));
|
messageConverters.add(new JsonMessageConverter(jsonMapper));
|
||||||
messageConverters.add(new ByteArrayMessageConverter());
|
messageConverters.add(new ByteArrayMessageConverter());
|
||||||
|
messageConverters.add(new StringMessageConverter());
|
||||||
|
messageConverters.add(new PrimitiveTypesFromStringMessageConverter(new DefaultConversionService()));
|
||||||
|
|
||||||
SmartCompositeMessageConverter messageConverter = new SmartCompositeMessageConverter(messageConverters);
|
SmartCompositeMessageConverter messageConverter = new SmartCompositeMessageConverter(messageConverters);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user