use of com.sequenceiq.cloudbreak.core.flow2.stack.CloudbreakFlowMessageService in project cloudbreak by hortonworks.
the class StackImageUpdateActions method handleImageUpdateFailure.
@Bean(name = "STACK_IMAGE_UPDATE_FAILED_STATE")
public AbstractStackFailureAction<StackImageUpdateState, StackImageUpdateEvent> handleImageUpdateFailure() {
return new AbstractStackFailureAction<>() {
@Inject
private CloudbreakFlowMessageService flowMessageService;
@Inject
private StackUpdater stackUpdater;
@Override
protected void doExecute(StackFailureContext context, StackFailureEvent payload, Map<Object, Object> variables) {
LOGGER.info("Error during Stack image update flow:", payload.getException());
String errorMessage = payload.getException().getMessage();
flowMessageService.fireEventAndLog(context.getStackView().getId(), Status.UPDATE_FAILED.name(), STACK_IMAGE_UPDATE_FAILED, errorMessage);
stackUpdater.updateStackStatus(context.getStackView().getId(), DetailedStackStatus.STACK_IMAGE_UPDATE_FAILED, errorMessage);
sendEvent(context, new StackEvent(StackImageUpdateEvent.STACK_IMAGE_UPDATE_FAILE_HANDLED_EVENT.event(), context.getStackView().getId()));
}
};
}
Aggregations