use of io.zeebe.broker.workflow.data.DeployedWorkflow in project zeebe by zeebe-io.
the class DeploymentCreateProcessor method updateWorkflowVersions.
private void updateWorkflowVersions(final DirectBuffer topicName, final ValueArray<DeployedWorkflow> deployedWorkflows) {
final Iterator<DeployedWorkflow> iterator = deployedWorkflows.iterator();
while (iterator.hasNext()) {
final DeployedWorkflow deployedWorkflow = iterator.next();
workflowVersions.setLatestVersion(topicName, deployedWorkflow.getBpmnProcessId(), deployedWorkflow.getVersion());
}
}
use of io.zeebe.broker.workflow.data.DeployedWorkflow in project zeebe by zeebe-io.
the class DeploymentCreateProcessor method writeEvent.
@Override
public long writeEvent(TypedEvent<DeploymentEvent> event, TypedStreamWriter writer) {
final DeploymentEvent deploymentEvent = event.getValue();
if (deploymentEvent.getState() == REJECTED) {
return writer.writeFollowupEvent(event.getKey(), deploymentEvent);
} else {
final TypedBatchWriter batch = writer.newBatch();
batch.addFollowUpEvent(event.getKey(), deploymentEvent, addRequestMetadata(event));
final DeployedWorkflowIterator deployedWorkflowIterator = deploymentResourceIterator.getDeployedWorkflows();
while (deployedWorkflowIterator.hasNext()) {
final DeployedWorkflow deployedWorkflow = deployedWorkflowIterator.next();
workflowEvent.setState(WorkflowState.CREATE).setBpmnProcessId(deployedWorkflow.getBpmnProcessId()).setVersion(deployedWorkflow.getVersion()).setBpmnXml(deployedWorkflowIterator.getDeploymentResource().getResource()).setDeploymentKey(event.getKey());
batch.addNewEvent(workflowEvent);
}
return batch.write();
}
}
Aggregations