use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent in project cloudbreak by hortonworks.
the class EnvironmentReactorFlowManager method triggerStackConfigUpdatesFlow.
public FlowIdentifier triggerStackConfigUpdatesFlow(EnvironmentView environment, String userCrn) {
stackService.cancelRunningStackConfigUpdates(environment);
LOGGER.info("Environment stack configurations update flow triggered.");
EnvStackConfigUpdatesEvent envStackConfigUpdatesEvent = EnvStackConfigUpdatesEventBuilder.anEnvStackConfigUpdatesEvent().withAccepted(new Promise<>()).withSelector(EnvStackConfigUpdatesStateSelectors.ENV_STACK_CONFIG_UPDATES_START_EVENT.selector()).withResourceId(environment.getId()).withResourceName(environment.getName()).withResourceCrn(environment.getResourceCrn()).build();
return eventSender.sendEvent(envStackConfigUpdatesEvent, new Event.Headers(getFlowTriggerUsercrn(userCrn)));
}
use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent in project cloudbreak by hortonworks.
the class EnvStackConfigUpdatesActions method collectClusterInfo.
@Bean(name = "STACK_CONFIG_UPDATES_START_STATE")
public Action<?, ?> collectClusterInfo() {
return new AbstractEnvStackConfigUpdatesAction<>(EnvStackConfigUpdatesEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStackConfigUpdatesEvent payload, Map<Object, Object> variables) {
EnvironmentDto environmentDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, getCurrentStatus(payload.getResourceId()), ResourceEvent.ENVIRONMENT_STACK_CONFIGS_UPDATE_STARTED, EnvStackConfigUpdatesState.STACK_CONFIG_UPDATES_START_STATE);
sendEvent(context, EnvStackConfigUpdatesHandlerSelectors.STACK_CONFIG_UPDATES_HANDLER_EVENT.selector(), environmentDto);
}
};
}
use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent in project cloudbreak by hortonworks.
the class StackConfigUpdatesHandler method accept.
@Override
public void accept(Event<EnvironmentDto> event) {
try {
stackPollerService.updateStackConfigurations(event.getData().getResourceId(), event.getData().getResourceCrn(), event.getHeaders().get(FlowConstants.FLOW_ID));
EnvStackConfigUpdatesEvent envStackConfigUpdatesEvent = EnvStackConfigUpdatesEventBuilder.anEnvStackConfigUpdatesEvent().withSelector(EnvStackConfigUpdatesStateSelectors.FINISH_ENV_STACK_CONFIG_UPDATES_EVENT.selector()).withResourceId(event.getData().getResourceId()).build();
eventSender().sendEvent(envStackConfigUpdatesEvent, event.getHeaders());
} catch (Exception e) {
eventSender().sendEvent(new EnvStackConfigUpdatesFailedEvent(event.getData(), e, null), event.getHeaders());
}
}
Aggregations