Search in sources :

Example 1 with SkipableElementProcessor

use of org.apache.inlong.manager.workflow.processor.SkipableElementProcessor in project incubator-inlong by apache.

the class ProcessorExecutorImpl method executeSkipAndNext.

private void executeSkipAndNext(Element element, WorkflowContext context) {
    if (!(element instanceof SkippableElement)) {
        throw new WorkflowException("element not instance of skip element " + element.getDisplayName());
    }
    if (!(element instanceof NextableElement)) {
        throw new WorkflowException("element not instance of nextable element " + element.getDisplayName());
    }
    ElementProcessor processor = this.getProcessor(element.getClass());
    if (!(processor instanceof SkipableElementProcessor)) {
        throw new WorkflowException("element processor not instance of skip processor " + element.getDisplayName());
    }
    // Execute skip logic
    SkipableElementProcessor skipableProcessor = (SkipableElementProcessor) processor;
    skipableProcessor.skip(element, context);
    // Execute next
    context.getActionContext().setAction(((NextableElement) element).defaultNextAction());
    List<Element> nextElements = processor.next(element, context);
    nextElements.forEach(next -> executeStart(next, context));
}
Also used : SkipableElementProcessor(org.apache.inlong.manager.workflow.processor.SkipableElementProcessor) NextableElement(org.apache.inlong.manager.workflow.definition.NextableElement) WorkflowException(org.apache.inlong.manager.common.exceptions.WorkflowException) Element(org.apache.inlong.manager.workflow.definition.Element) NextableElement(org.apache.inlong.manager.workflow.definition.NextableElement) SkippableElement(org.apache.inlong.manager.workflow.definition.SkippableElement) SkippableElement(org.apache.inlong.manager.workflow.definition.SkippableElement) ElementProcessor(org.apache.inlong.manager.workflow.processor.ElementProcessor) SkipableElementProcessor(org.apache.inlong.manager.workflow.processor.SkipableElementProcessor)

Aggregations

WorkflowException (org.apache.inlong.manager.common.exceptions.WorkflowException)1 Element (org.apache.inlong.manager.workflow.definition.Element)1 NextableElement (org.apache.inlong.manager.workflow.definition.NextableElement)1 SkippableElement (org.apache.inlong.manager.workflow.definition.SkippableElement)1 ElementProcessor (org.apache.inlong.manager.workflow.processor.ElementProcessor)1 SkipableElementProcessor (org.apache.inlong.manager.workflow.processor.SkipableElementProcessor)1