use of io.zeebe.broker.system.deployment.data.TopicPartitions.TopicPartitionIterator 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.TopicPartitions.TopicPartitionIterator in project zeebe by zeebe-io.
the class DeploymentCreateProcessor method isTopicCreated.
private boolean isTopicCreated(final DirectBuffer topicName) {
boolean hasPartition = false;
boolean topicPartitionsCreated = true;
final TopicPartitionIterator iterator = topicPartitions.iterator();
while (iterator.hasNext()) {
final TopicPartition partition = iterator.next();
if (BufferUtil.equals(topicName, partition.getTopicName())) {
hasPartition = true;
topicPartitionsCreated &= partition.getState() == TopicPartitions.STATE_CREATED;
}
}
return hasPartition && topicPartitionsCreated;
}
Aggregations