use of com.sequenceiq.freeipa.flow.stack.AbstractStackFailureAction in project cloudbreak by hortonworks.
the class StackProvisionActions method stackCreationFailureAction.
@Bean(name = "STACK_CREATION_FAILED_STATE")
public Action<?, ?> stackCreationFailureAction() {
return new AbstractStackFailureAction<StackProvisionState, StackProvisionEvent>() {
@Override
protected StackFailureContext createFlowContext(FlowParameters flowParameters, StateContext<StackProvisionState, StackProvisionEvent> stateContext, StackFailureEvent payload) {
Flow flow = getFlow(flowParameters.getFlowId());
Stack stack = stackService.getStackById(payload.getResourceId());
MDCBuilder.buildMdcContext(stack);
flow.setFlowFailed(payload.getException());
return new StackFailureContext(flowParameters, stack);
}
@Override
protected void doExecute(StackFailureContext context, StackFailureEvent payload, Map<Object, Object> variables) {
stackProvisionService.handleStackCreationFailure(context.getStack(), payload.getException());
sendEvent(context);
}
@Override
protected Selectable createRequest(StackFailureContext context) {
return new StackEvent(StackProvisionEvent.STACKCREATION_FAILURE_HANDLED_EVENT.event(), context.getStack().getId());
}
};
}
Aggregations