use of io.zeebe.broker.workflow.data.DeploymentResource in project zeebe by zeebe-io.
the class DeploymentCreateProcessor method readAndValidateWorkflows.
private boolean readAndValidateWorkflows(final DeploymentEvent deploymentEvent) {
final DirectBuffer topicName = deploymentEvent.getTopicName();
final StringBuilder validationErrors = new StringBuilder();
boolean success = true;
deploymentResourceIterator.wrap(deploymentEvent);
if (!deploymentResourceIterator.hasNext()) {
validationErrors.append("Deployment doesn't contain a resource to deploy.");
success = false;
}
while (deploymentResourceIterator.hasNext()) {
final DeploymentResource deploymentResource = deploymentResourceIterator.next();
try {
success &= readAndValidateWorkflowsOfResource(deploymentResource, topicName, validationErrors);
} catch (Exception e) {
validationErrors.append(String.format("Failed to deploy resource '%s':\n", bufferAsString(deploymentResource.getResourceName())));
validationErrors.append(generateErrorMessage(e));
success = false;
}
}
deploymentEvent.setErrorMessage(validationErrors.toString());
return success;
}
Aggregations