use of io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment 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);
}
use of io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment 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);
}
use of io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment in project zeebe by zeebe-io.
the class RemoteWorkflowsManager method onRequestSuccessful.
private void onRequestSuccessful(ClientResponse request) {
try {
final DirectBuffer responseBuffer = request.getResponseBuffer();
createResponse.wrap(responseBuffer, 0, responseBuffer.capacity());
final long workflowKey = createResponse.getWorkflowKey();
final int partitionId = createResponse.getPartitionId();
final long deploymentKey = createResponse.getDeploymentKey();
final PendingWorkflow pendingWorkflow = pendingWorkflows.get(workflowKey, partitionId);
if (pendingWorkflow != null && pendingWorkflow.getState() == PendingWorkflows.STATE_CREATE) {
// ignore response if pending workflow or deployment is already processed
pendingWorkflows.put(workflowKey, partitionId, PendingWorkflows.STATE_CREATED, deploymentKey);
}
if (isDeploymentDistributed(deploymentKey)) {
final PendingDeployment pendingDeployment = pendingDeployments.get(deploymentKey);
writer.writeDeploymentEvent(pendingDeployment.getDeploymentEventPosition(), DeploymentState.DISTRIBUTED);
}
} finally {
request.close();
}
}
use of io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment in project zeebe by zeebe-io.
the class DeploymentDistributedProcessor method processEvent.
@Override
public void processEvent(TypedEvent<DeploymentEvent> event) {
final PendingDeployment pendingDeployment = pendingDeployments.get(event.getKey());
if (pendingDeployment != null && !pendingDeployment.isResolved()) {
event.getValue().setState(CREATED);
Loggers.SYSTEM_LOGGER.debug("Deployment with key '{}' on topic '{}' successful.", pendingDeployment.getDeploymentKey(), BufferUtil.bufferAsString(pendingDeployment.getTopicName()));
}
if (!event.getMetadata().hasRequestMetadata()) {
throw new RuntimeException("missing request metadata of deployment");
}
}
use of io.zeebe.broker.system.deployment.data.PendingDeployments.PendingDeployment in project zeebe by zeebe-io.
the class DeploymentTimedOutProcessor method processEvent.
@Override
public void processEvent(TypedEvent<DeploymentEvent> event) {
final PendingDeployment pendingDeployment = pendingDeployments.get(event.getKey());
if (pendingDeployment != null && !pendingDeployment.isResolved()) {
event.getValue().setState(REJECT);
workflowKeys.clear();
collectWorkflowKeysForDeployment(event.getKey());
LOG.info("Creation of deployment with key '{}' timed out. Delete containg workflows with keys: {}", event.getKey(), workflowKeys);
}
if (!event.getMetadata().hasRequestMetadata()) {
throw new RuntimeException("missing request metadata of deployment");
}
}
Aggregations