make aggregation step optional
This commit is contained in:
@@ -95,30 +95,38 @@ public class Pipeline {
|
|||||||
return Mono.just(aggregateResult);
|
return Mono.just(aggregateResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList<Step> opSteps = (LinkedList<Step>) steps.clone();
|
if(CollectionUtils.isEmpty(steps)) {
|
||||||
Step step1 = opSteps.removeFirst();
|
return handleOutput(input);
|
||||||
step1.beforeRun(stepContext, null);
|
}else {
|
||||||
Mono<List<StepResponse>> result = createStep(step1).expand(response -> {
|
LinkedList<Step> opSteps = (LinkedList<Step>) steps.clone();
|
||||||
if (opSteps.isEmpty() || response.isStop()) {
|
Step step1 = opSteps.removeFirst();
|
||||||
return Mono.empty();
|
step1.beforeRun(stepContext, null);
|
||||||
}
|
Mono<List<StepResponse>> result = createStep(step1).expand(response -> {
|
||||||
Step step = opSteps.pop();
|
if (opSteps.isEmpty() || response.isStop()) {
|
||||||
step.beforeRun(stepContext, response);
|
return Mono.empty();
|
||||||
return createStep(step);
|
}
|
||||||
}).flatMap(response -> Flux.just(response)).collectList();
|
Step step = opSteps.pop();
|
||||||
return result.flatMap(clientResponse -> {
|
step.beforeRun(stepContext, response);
|
||||||
// 数据转换
|
return createStep(step);
|
||||||
long t3 = System.currentTimeMillis();
|
}).flatMap(response -> Flux.just(response)).collectList();
|
||||||
AggregateResult aggResult = this.doInputDataMapping(input, null);
|
return result.flatMap(clientResponse -> {
|
||||||
this.stepContext.addElapsedTime(input.getName()+"聚合接口响应结果数据转换", System.currentTimeMillis() - t3);
|
return handleOutput(input);
|
||||||
if(this.stepContext.isDebug()) {
|
});
|
||||||
LogService.setBizId(this.stepContext.getTraceId());
|
}
|
||||||
String jsonString = JSON.toJSONString(aggResult);
|
}
|
||||||
LOGGER.info("aggResult {}", jsonString);
|
|
||||||
LOGGER.info("stepContext {}", JSON.toJSONString(stepContext));
|
private Mono<AggregateResult> handleOutput(Input input){
|
||||||
}
|
// 数据转换
|
||||||
return Mono.just(aggResult);
|
long t3 = System.currentTimeMillis();
|
||||||
});
|
AggregateResult aggResult = this.doInputDataMapping(input, null);
|
||||||
|
this.stepContext.addElapsedTime(input.getName()+"聚合接口响应结果数据转换", System.currentTimeMillis() - t3);
|
||||||
|
if(this.stepContext.isDebug()) {
|
||||||
|
LogService.setBizId(this.stepContext.getTraceId());
|
||||||
|
String jsonString = JSON.toJSONString(aggResult);
|
||||||
|
LOGGER.info("aggResult {}", jsonString);
|
||||||
|
LOGGER.info("stepContext {}", JSON.toJSONString(stepContext));
|
||||||
|
}
|
||||||
|
return Mono.just(aggResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
Reference in New Issue
Block a user