When creating a processor, controller service, or reporting task, give the component up to 50 ms to complete validation before returning the DTO. This closes
@@ -1595,7 +1595,10 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
revision,
processorDTO,
() -> processorDAO.createProcessor(groupId, processorDTO),
- processor -> dtoFactory.createProcessorDto(processor));
+ processor -> {
+ awaitValidationCompletion(processor);
+ return dtoFactory.createProcessorDto(processor);
+ });
final ProcessorNode processor = processorDAO.getProcessor(processorDTO.getId());
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(processor);
@@ -2168,20 +2171,22 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
// Unfortunately, we can not use the createComponent() method here because createComponent() wants to obtain the read lock
// on the group. The Controller Service may or may not have a Process Group (it won't if it's controller-scoped).
final ControllerServiceNode controllerService = controllerServiceDAO.createControllerService(controllerServiceDTO);
- final ControllerServiceDTO dto = dtoFactory.createControllerServiceDto(controllerService);
-
controllerFacade.save();
+ awaitValidationCompletion(controllerService);
+ final ControllerServiceDTO dto = dtoFactory.createControllerServiceDto(controllerService);
+
final FlowModification lastMod = new FlowModification(revision.incrementRevision(revision.getClientId()), user.getIdentity());
return new StandardRevisionUpdate<>(dto, lastMod);
});
} else {
snapshot = revisionManager.updateRevision(claim, user, () -> {
final ControllerServiceNode controllerService = controllerServiceDAO.createControllerService(controllerServiceDTO);
- final ControllerServiceDTO dto = dtoFactory.createControllerServiceDto(controllerService);
-
controllerFacade.save();
+ awaitValidationCompletion(controllerService);
+ final ControllerServiceDTO dto = dtoFactory.createControllerServiceDto(controllerService);
+
final FlowModification lastMod = new FlowModification(revision.incrementRevision(revision.getClientId()), user.getIdentity());
return new StandardRevisionUpdate<>(dto, lastMod);
});
@@ -2573,6 +2578,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
// save the update
controllerFacade.save();
+ awaitValidationCompletion(reportingTask);
final ReportingTaskDTO dto = dtoFactory.createReportingTaskDto(reportingTask);
final FlowModification lastMod = new FlowModification(revision.incrementRevision(revision.getClientId()), user.getIdentity());
