use of com.sequenceiq.datalake.flow.create.event.StorageValidationSuccessEvent in project cloudbreak by hortonworks.
the class SdxCreateActions method rdsCreation.
@Bean(name = "SDX_CREATION_WAIT_RDS_STATE")
public Action<?, ?> rdsCreation() {
return new AbstractSdxAction<>(StorageValidationSuccessEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, StorageValidationSuccessEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, StorageValidationSuccessEvent payload, Map<Object, Object> variables) throws Exception {
RdsWaitRequest req = new RdsWaitRequest(context);
sendEvent(context, req.selector(), req);
}
@Override
protected Object getFailurePayload(StorageValidationSuccessEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return SdxCreateFailedEvent.from(payload, ex);
}
};
}
use of com.sequenceiq.datalake.flow.create.event.StorageValidationSuccessEvent in project cloudbreak by hortonworks.
the class StorageValidationHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<StorageValidationRequest> event) {
StorageValidationRequest storageValidationRequest = event.getData();
Long sdxId = storageValidationRequest.getResourceId();
String userId = storageValidationRequest.getUserId();
try {
Optional<SdxCluster> sdxCluster = sdxClusterRepository.findById(sdxId);
if (sdxCluster.isPresent()) {
DetailedEnvironmentResponse env = environmentService.getDetailedEnvironmentResponseByName(sdxCluster.get().getEnvName());
stackRequestManifester.configureStackForSdxCluster(sdxCluster.get(), env);
return new StorageValidationSuccessEvent(sdxId, userId);
} else {
throw notFound("SDX cluster", sdxId).get();
}
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in sdx storage validation phase", anotherException);
return new SdxCreateFailedEvent(sdxId, userId, anotherException);
}
}
Aggregations