GH-388 Adding utility to interogate Function types

- refactoring of BeanFactoryAwareFunctionRegistry to eliminate the need for FunctionType as it takes certain assumptions that are no longer valid
- adding support for multiple acceptedOutputTypes to FunctionCatalog

Resolves #388
This commit is contained in:
Oleg Zhurakousky
2019-07-24 12:12:52 +02:00
parent fbeee8bc37
commit 243cf95eca
8 changed files with 739 additions and 246 deletions

View File

@@ -244,9 +244,8 @@ public class RequestProcessor {
responseEntityMono = Mono.just(ResponseEntity.status(HttpStatus.ACCEPTED).build());
}
else if (function instanceof FunctionInvocationWrapper) {
Object targetFunction = ((FunctionInvocationWrapper) function).getTarget();
Publisher<?> result = (Publisher<?>) function.apply(flux);
if (targetFunction instanceof Consumer) {
if (((FunctionInvocationWrapper) function).isConsumer()) {
if (result != null) {
((Mono) result).subscribe();
}
@@ -261,8 +260,7 @@ public class RequestProcessor {
responseEntityMono = stream(wrapper, result);
}
else {
responseEntityMono = response(wrapper, getTargetIfRouting(wrapper, ((FunctionInvocationWrapper) function).getTarget()), result,
responseEntityMono = response(wrapper, getTargetIfRouting(wrapper, function), result,
body == null ? null : !(body instanceof Collection), false);
}
}