Search in sources :

Example 1 with DeployedWorkflow

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());
    }
}
Also used : DeployedWorkflow(io.zeebe.broker.workflow.data.DeployedWorkflow)

Example 2 with DeployedWorkflow

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();
    }
}
Also used : TypedBatchWriter(io.zeebe.broker.logstreams.processor.TypedBatchWriter) DeployedWorkflow(io.zeebe.broker.workflow.data.DeployedWorkflow) DeploymentEvent(io.zeebe.broker.workflow.data.DeploymentEvent)

Aggregations

DeployedWorkflow (io.zeebe.broker.workflow.data.DeployedWorkflow)2 TypedBatchWriter (io.zeebe.broker.logstreams.processor.TypedBatchWriter)1 DeploymentEvent (io.zeebe.broker.workflow.data.DeploymentEvent)1