- if (acmDeployer.primeRapp(rapp) && dmeDeployer.primeRapp(rapp)) {
- rapp.setState(RappState.PRIMED);
- return ResponseEntity.ok().build();
+ try {
+ //Configuring the deployment artifact needs to be done before starting the priming with other components
+ //If there are additional conditions needs to be checked before priming, This needs handled as part of pre-priming stage.
+ if (deploymentArtifactsService.configureDeploymentArtifacts(rapp) && rappDeployers.parallelStream()
+ .allMatch(
+ rappDeployer -> rappDeployer.primeRapp(
+ rapp))) {
+ rapp.setState(RappState.PRIMED);
+ return ResponseEntity.ok().build();
+ }
+ } catch (RappValidationException e) {
+ rapp.setState(RappState.COMMISSIONED);
+ throw e;