Cleanup of Azure sample

This commit is contained in:
Oleg Zhurakousky
2021-11-18 14:59:40 +01:00
parent 6031cc83f3
commit aea3b548da
5 changed files with 48 additions and 32 deletions

View File

@@ -107,9 +107,7 @@ public class FunctionInvoker<I, O> {
binding.setValue(result);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public O handleRequest(I input, ExecutionContext executionContext) {
String functionDefinition = executionContext.getFunctionName();
private FunctionInvocationWrapper discoverFunction(String functionDefinition) {
FunctionInvocationWrapper function = FUNCTION_CATALOG.lookup(functionDefinition);
if (function != null && StringUtils.hasText(functionDefinition) && !function.getFunctionDefinition().equals(functionDefinition)) {
this.registerFunction(functionDefinition);
@@ -119,6 +117,13 @@ public class FunctionInvoker<I, O> {
this.registerFunction(functionDefinition);
function = FUNCTION_CATALOG.lookup(functionDefinition);
}
return function;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public O handleRequest(I input, ExecutionContext executionContext) {
String functionDefinition = executionContext.getFunctionName();
FunctionInvocationWrapper function = this.discoverFunction(functionDefinition);
Object enhancedInput = enhanceInputIfNecessary(input, executionContext);
Object output = function.apply(enhancedInput);