Search in sources :

Example 1 with KafkaMultipleConditionStorage

use of io.kestra.runner.kafka.KafkaMultipleConditionStorage in project kestra by kestra-io.

the class FlowTriggerWithExecutionTransformer method transform.

@Override
public List<Execution> transform(final ExecutorFlowTrigger value) {
    MultipleConditionStorageInterface multipleConditionStorage = new KafkaMultipleConditionStorage(this.multipleStore);
    // multiple conditions storage
    kafkaFlowExecutor.findByExecution(value.getExecution()).ifPresent(flow -> {
        flowService.multipleFlowTrigger(Stream.of(value.getFlowHavingTrigger()), flow, value.getExecution(), multipleConditionStorage).forEach(triggerExecutionWindow -> {
            this.multipleStore.put(triggerExecutionWindow.uid(), triggerExecutionWindow);
        });
    });
    List<Execution> triggeredExecutions = flowService.flowTriggerExecution(Stream.of(value.getFlowHavingTrigger()), value.getExecution(), multipleConditionStorage);
    // Trigger is done, remove matching multiple condition
    flowService.multipleFlowToDelete(Stream.of(value.getFlowHavingTrigger()), multipleConditionStorage).forEach(r -> this.multipleStore.delete(r.uid()));
    return triggeredExecutions;
}
Also used : MultipleConditionStorageInterface(io.kestra.core.models.triggers.multipleflows.MultipleConditionStorageInterface) Execution(io.kestra.core.models.executions.Execution) KafkaMultipleConditionStorage(io.kestra.runner.kafka.KafkaMultipleConditionStorage)

Aggregations

Execution (io.kestra.core.models.executions.Execution)1 MultipleConditionStorageInterface (io.kestra.core.models.triggers.multipleflows.MultipleConditionStorageInterface)1 KafkaMultipleConditionStorage (io.kestra.runner.kafka.KafkaMultipleConditionStorage)1