use of com.sequenceiq.flow.component.sleep.event.SleepFailedEvent in project cloudbreak by hortonworks.
the class SleepFlow method sleepFailed.
@Bean("SLEEP_FAILED_STATE")
public Action<?, ?> sleepFailed() {
return new AbstractAction<>(SleepFailedEvent.class) {
@Override
protected CommonContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SleepFailedEvent payload) {
return new CommonContext(flowParameters);
}
@Override
protected void doExecute(CommonContext context, SleepFailedEvent payload, Map<Object, Object> variables) throws Exception {
LOGGER.info("Sleep fail handled!");
Flow flow = getFlow(context.getFlowId());
flow.setFlowFailed(new Exception(payload.getReason()));
sendEvent(context, SleepEvent.SLEEP_FAIL_HANDLED_EVENT.selector(), payload);
}
@Override
protected Object getFailurePayload(SleepFailedEvent payload, Optional<CommonContext> flowContext, Exception ex) {
return null;
}
};
}
Aggregations