make aggregation step optional

This commit is contained in:
Francis Dong
2020-12-01 15:29:32 +08:00
parent 9114a87624
commit 7f048a88e8

View File

@@ -95,6 +95,9 @@ public class Pipeline {
return Mono.just(aggregateResult);
}
if(CollectionUtils.isEmpty(steps)) {
return handleOutput(input);
}else {
LinkedList<Step> opSteps = (LinkedList<Step>) steps.clone();
Step step1 = opSteps.removeFirst();
step1.beforeRun(stepContext, null);
@@ -107,6 +110,12 @@ public class Pipeline {
return createStep(step);
}).flatMap(response -> Flux.just(response)).collectList();
return result.flatMap(clientResponse -> {
return handleOutput(input);
});
}
}
private Mono<AggregateResult> handleOutput(Input input){
// 数据转换
long t3 = System.currentTimeMillis();
AggregateResult aggResult = this.doInputDataMapping(input, null);
@@ -118,7 +127,6 @@ public class Pipeline {
LOGGER.info("stepContext {}", JSON.toJSONString(stepContext));
}
return Mono.just(aggResult);
});
}
@SuppressWarnings("unchecked")