Search in sources :

Example 1 with CloudbreakFlowMessageService

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()));
        }
    };
}
Also used : StackUpdater(com.sequenceiq.cloudbreak.service.StackUpdater) AbstractStackFailureAction(com.sequenceiq.cloudbreak.core.flow2.stack.AbstractStackFailureAction) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) StackFailureEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent) StackFailureContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackFailureContext) Map(java.util.Map) CloudbreakFlowMessageService(com.sequenceiq.cloudbreak.core.flow2.stack.CloudbreakFlowMessageService) Bean(org.springframework.context.annotation.Bean)

Aggregations

AbstractStackFailureAction (com.sequenceiq.cloudbreak.core.flow2.stack.AbstractStackFailureAction)1 CloudbreakFlowMessageService (com.sequenceiq.cloudbreak.core.flow2.stack.CloudbreakFlowMessageService)1 StackFailureContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackFailureContext)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 StackFailureEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent)1 StackUpdater (com.sequenceiq.cloudbreak.service.StackUpdater)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1