use of com.sequenceiq.datalake.flow.repair.event.SdxRepairStartEvent 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.SdxRepairStartEvent in project cloudbreak by hortonworks.
the class SdxReactorFlowManager method triggerSdxRepairFlow.
public FlowIdentifier triggerSdxRepairFlow(SdxCluster cluster, SdxRepairRequest repairRequest) {
LOGGER.info("Trigger Datalake repair for: {} with settings: {}", cluster, repairRequest);
SdxRepairSettings settings = SdxRepairSettings.from(repairRequest);
String selector = SDX_REPAIR_EVENT.event();
String userId = ThreadBasedUserCrnProvider.getUserCrn();
return notify(selector, new SdxRepairStartEvent(selector, cluster.getId(), userId, settings), cluster.getClusterName());
}
Aggregations