use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesFailedEvent in project cloudbreak by hortonworks.
the class EnvStackConfigUpdatesActions method failedAction.
@Bean(name = "STACK_CONFIG_UPDATES_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractEnvStackConfigUpdatesAction<>(EnvStackConfigUpdatesFailedEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStackConfigUpdatesFailedEvent payload, Map<Object, Object> variables) {
LOGGER.warn(String.format("Failed to update environments stack configs '%s'. Status: '%s'.", payload.getEnvironmentDto(), payload.getEnvironmentStatus()), payload.getException());
EnvironmentDto environmentDto = environmentStatusUpdateService.updateFailedEnvironmentStatusAndNotify(context, payload, getCurrentStatus(payload.getResourceId()), ResourceEvent.ENVIRONMENT_STACK_CONFIGS_UPDATE_FAILED, EnvStackConfigUpdatesState.STACK_CONFIG_UPDATES_FAILED_STATE);
metricService.incrementMetricCounter(MetricType.ENV_STACK_CONFIG_UPDATE_FAILED, environmentDto, payload.getException());
sendEvent(context, HANDLE_FAILED_ENV_STACK_CONIFG_UPDATES_EVENT.event(), payload);
}
};
}
use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesFailedEvent 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