Search in sources :

Example 1 with WorkflowEvent

use of io.zeebe.broker.workflow.data.WorkflowEvent in project zeebe by zeebe-io.

the class WorkflowDeleteProcessor method updateState.

@Override
public void updateState(TypedEvent<WorkflowEvent> event) {
    final long workflowKey = event.getKey();
    final WorkflowEvent workflowEvent = event.getValue();
    for (int partitionId : partitionIds) {
        pendingWorkflows.remove(workflowKey, partitionId);
    }
    final PendingDeployment pendingDeployment = pendingDeployments.get(workflowEvent.getDeploymentKey());
    // reset the workflow's version which is incremented on creation
    workflowVersions.setLatestVersion(pendingDeployment.getTopicName(), workflowEvent.getBpmnProcessId(), workflowEvent.getVersion() - 1);
}
Also used : PendingDeployment(io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment) WorkflowEvent(io.zeebe.broker.workflow.data.WorkflowEvent)

Example 2 with WorkflowEvent

use of io.zeebe.broker.workflow.data.WorkflowEvent in project zeebe by zeebe-io.

the class WorkflowCreateProcessor method processEvent.

@Override
public void processEvent(TypedEvent<WorkflowEvent> event) {
    partitionIds.clear();
    final WorkflowEvent workflowEvent = event.getValue();
    final PendingDeployment pendingDeployment = pendingDeployments.get(workflowEvent.getDeploymentKey());
    ensureNotNull("pending deployment", pendingDeployment);
    final DirectBuffer topicName = pendingDeployment.getTopicName();
    final TopicPartitionIterator iterator = topicPartitions.iterator();
    while (iterator.hasNext()) {
        final TopicPartition topicPartition = iterator.next();
        if (BufferUtil.equals(topicName, topicPartition.getTopicName())) {
            partitionIds.add(topicPartition.getPartitionId());
        }
    }
    ensureGreaterThan("partition ids", partitionIds.size(), 0);
}
Also used : DirectBuffer(org.agrona.DirectBuffer) PendingDeployment(io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment) TopicPartitionIterator(io.zeebe.broker.system.deployment.data.TopicPartitions.TopicPartitionIterator) TopicPartition(io.zeebe.broker.system.deployment.data.TopicPartitions.TopicPartition) WorkflowEvent(io.zeebe.broker.workflow.data.WorkflowEvent)

Aggregations

PendingDeployment (io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment)2 WorkflowEvent (io.zeebe.broker.workflow.data.WorkflowEvent)2 TopicPartition (io.zeebe.broker.system.deployment.data.TopicPartitions.TopicPartition)1 TopicPartitionIterator (io.zeebe.broker.system.deployment.data.TopicPartitions.TopicPartitionIterator)1 DirectBuffer (org.agrona.DirectBuffer)1