use of com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.
the class UpgradeCcmTunnelUpdateHandler method accept.
@Override
public void accept(Event<EnvironmentDto> environmentDtoEvent) {
LOGGER.debug("In UpgradeCcmTunnelUpdateHandler.accept");
EnvironmentDto environmentDto = environmentDtoEvent.getData();
try {
environmentService.updateTunnelByEnvironmentId(environmentDto.getResourceId(), Tunnel.latestUpgradeTarget());
UpgradeCcmEvent upgradeCcmEvent = UpgradeCcmEvent.builder().withSelector(UpgradeCcmStateSelectors.UPGRADE_CCM_DATALAKE_EVENT.selector()).withResourceCrn(environmentDto.getResourceCrn()).withResourceId(environmentDto.getId()).withResourceName(environmentDto.getName()).build();
eventSender().sendEvent(upgradeCcmEvent, environmentDtoEvent.getHeaders());
LOGGER.debug("UPGRADE_CCM_DATALAKE_EVENT event sent");
} catch (Exception e) {
UpgradeCcmFailedEvent failedEvent = new UpgradeCcmFailedEvent(environmentDto, e, EnvironmentStatus.UPGRADE_CCM_TUNNEL_UPDATE_FAILED);
eventSender().sendEvent(failedEvent, environmentDtoEvent.getHeaders());
LOGGER.debug("UPGRADE_CCM_TUNNEL_UPDATE_FAILED event sent");
}
}
use of com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.
the class EnvironmentReactorFlowManager method triggerCcmUpgradeFlow.
public FlowIdentifier triggerCcmUpgradeFlow(EnvironmentDto environment, String userCrn) {
LOGGER.info("Environment CCM upgrade flow triggered for environment {}", environment.getName());
UpgradeCcmEvent upgradeCcmEvent = UpgradeCcmEvent.builder().withAccepted(new Promise<>()).withResourceCrn(environment.getResourceCrn()).withResourceId(environment.getId()).withResourceName(environment.getName()).withSelector(UpgradeCcmStateSelectors.UPGRADE_CCM_VALIDATION_EVENT.selector()).build();
FlowIdentifier flowIdentifier = eventSender.sendEvent(upgradeCcmEvent, new Event.Headers(getFlowTriggerUsercrn(userCrn)));
LOGGER.debug("Environment CCM upgrade flow trigger event sent for environment {}", environment.getName());
return flowIdentifier;
}
Aggregations