use of com.sequenceiq.datalake.flow.repair.event.SdxRepairStartRequest in project cloudbreak by hortonworks.
the class SdxRepairActions method sdxRepairStarted.
@Bean(name = "SDX_REPAIR_START_STATE")
public Action<?, ?> sdxRepairStarted() {
return new AbstractSdxAction<>(SdxRepairStartEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxRepairStartEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxRepairStartEvent payload, Map<Object, Object> variables) throws Exception {
LOGGER.info("Start repair flow for Datalake: {}", payload.getResourceId());
SdxRepairStartRequest request = new SdxRepairStartRequest(payload.getResourceId(), payload.getUserId(), payload.getRepairSettings());
sendEvent(context, request.selector(), request);
}
@Override
protected Object getFailurePayload(SdxRepairStartEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return SdxRepairCouldNotStartEvent.from(payload, ex);
}
};
}
use of com.sequenceiq.datalake.flow.repair.event.SdxRepairStartRequest in project cloudbreak by hortonworks.
the class SdxRepairStartHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxRepairStartRequest> event) {
SdxRepairStartRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
try {
repairService.startSdxRepair(sdxId, request.getRepairSettings());
} catch (Exception e) {
LOGGER.error("Sdx repair start failed, sdxId: {}, error: {}", sdxId, e.getMessage());
return new SdxRepairCouldNotStartEvent(sdxId, userId, e);
}
return new SdxRepairInProgressEvent(sdxId, userId);
}
Aggregations