use of com.sequenceiq.datalake.flow.dr.restore.event.DatalakeDatabaseRestoreCouldNotStartEvent in project cloudbreak by hortonworks.
the class DatalakeRestoreActions method restoreCouldNotStart.
@Bean(name = "DATALAKE_DATABASE_RESTORE_COULD_NOT_START_STATE")
public Action<?, ?> restoreCouldNotStart() {
return new AbstractSdxAction<>(DatalakeDatabaseRestoreCouldNotStartEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, DatalakeDatabaseRestoreCouldNotStartEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, DatalakeDatabaseRestoreCouldNotStartEvent payload, Map<Object, Object> variables) {
Exception exception = payload.getException();
LOGGER.error("Datalake database restore could not be started for datalake with id: {}", payload.getResourceId(), exception);
String operationId = (String) variables.get(OPERATION_ID);
sdxBackupRestoreService.updateDatabaseStatusEntry(operationId, SdxOperationStatus.FAILED, exception.getLocalizedMessage());
sendEvent(context, DATALAKE_DATABASE_RESTORE_FAILURE_HANDLED_EVENT.event(), payload);
}
@Override
protected Object getFailurePayload(DatalakeDatabaseRestoreCouldNotStartEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return DatalakeDatabaseRestoreFailedEvent.from(payload, ex);
}
};
}
Aggregations