Refactor FunctionCatalog implementation

This commit is contained in:
Oleg Zhurakousky
2020-09-17 14:02:51 +02:00
parent 978a474c81
commit 72f05fc591
34 changed files with 1597 additions and 1643 deletions

View File

@@ -169,7 +169,7 @@ public class FunctionInvoker implements RequestStreamHandler {
MessageBuilder messageBuilder = null;
Object request = this.mapper.readValue(payload, Object.class);
Type inputType = FunctionTypeUtils.getInputType(function.getFunctionType(), 0);
Type inputType = function.getInputType();
if (FunctionTypeUtils.isMessage(inputType)) {
inputType = FunctionTypeUtils.getImmediateGenericType(inputType, 0);
}

View File

@@ -16,6 +16,7 @@
package org.springframework.cloud.function.adapter.aws;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -26,13 +27,16 @@ import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer;
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
/**
* @param <E> event type
* @param <O> result types
* @author Mark Fisher
* @author Oleg Zhurakousky
*
*/
@Deprecated
public class SpringBootRequestHandler<E, O> extends AbstractSpringFunctionAdapterInitializer<Context>
implements RequestHandler<E, Object> {
@@ -66,11 +70,13 @@ public class SpringBootRequestHandler<E, O> extends AbstractSpringFunctionAdapte
}
protected boolean acceptsInput() {
return !this.getInspector().getInputType(function()).equals(Void.class);
Type inputType = ((FunctionInvocationWrapper) this.function()).getInputType();
return inputType == null || inputType.equals(Void.class) ? false : true;
}
protected boolean returnsOutput() {
return !this.getInspector().getOutputType(function()).equals(Void.class);
Type outputType = ((FunctionInvocationWrapper) this.function()).getOutputType();
return outputType == null || outputType.equals(Void.class) ? false : true;
}
private boolean isSingleValue(Object input) {