Search in sources :

Example 1 with ProduceEvent

use of io.serverlessworkflow.api.produce.ProduceEvent in project automatiko-engine by automatiko-io.

the class ServerlessWorkflowParser method produceEvents.

protected void produceEvents(List<ProduceEvent> events, ServerlessWorkflowFactory factory, Workflow workflow, AtomicLong ids, NodeContainer container, long startNodeId, long endNodeId) {
    Node prevNode = null;
    Node currentNode = null;
    for (ProduceEvent event : events) {
        currentNode = factory.produceMessageNode(ids.getAndIncrement(), "produceEvent_" + startNodeId, workflow, event, container);
        if (prevNode != null) {
            factory.connect(prevNode.getId(), currentNode.getId(), "connect_" + prevNode.getId() + "_" + currentNode.getId(), container, false);
        } else {
            factory.connect(startNodeId, currentNode.getId(), "connect_" + startNodeId + "_" + currentNode.getId(), container, false);
        }
        prevNode = currentNode;
    }
    factory.connect(prevNode.getId(), endNodeId, "connect_" + prevNode.getId() + "_" + endNodeId, container, false);
}
Also used : ProduceEvent(io.serverlessworkflow.api.produce.ProduceEvent) TimerNode(io.automatiko.engine.workflow.process.core.node.TimerNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) SubProcessNode(io.automatiko.engine.workflow.process.core.node.SubProcessNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode)

Aggregations

Node (io.automatiko.engine.workflow.process.core.Node)1 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)1 BoundaryEventNode (io.automatiko.engine.workflow.process.core.node.BoundaryEventNode)1 CompositeContextNode (io.automatiko.engine.workflow.process.core.node.CompositeContextNode)1 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)1 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)1 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)1 SubProcessNode (io.automatiko.engine.workflow.process.core.node.SubProcessNode)1 TimerNode (io.automatiko.engine.workflow.process.core.node.TimerNode)1 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)1 ProduceEvent (io.serverlessworkflow.api.produce.ProduceEvent)1