@Autowired
private AmbariClusterInstallerMailSenderService ambariClusterInstallerMailSenderService;
@Override
public void accept(Event<ClusterCreationFailure> event) {
ClusterCreationFailure clusterCreationFailure = event.getData();
Long clusterId = clusterCreationFailure.getClusterId();
Cluster cluster = clusterRepository.findById(clusterId);
MDCBuilder.buildMdcContext(cluster);
LOGGER.info("Accepted {} event.", ReactorConfig.CLUSTER_CREATE_FAILED_EVENT, clusterId);
String detailedMessage = clusterCreationFailure.getDetailedMessage();
cluster.setStatus(Status.CREATE_FAILED);
cluster.setStatusReason(detailedMessage);
clusterRepository.save(cluster);
if (cluster.getEmailNeeded()) {
ambariClusterInstallerMailSenderService.sendFailEmail(cluster.getOwner());