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);
}
Aggregations