use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterTerminationRequest in project cloudbreak by hortonworks.
the class ClusterTerminationActions method terminatingCluster.
@Bean(name = "CLUSTER_TERMINATING_STATE")
public Action<?, ?> terminatingCluster() {
return new AbstractClusterAction<StackEvent>(StackEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, StackEvent payload, Map<Object, Object> variables) {
clusterTerminationFlowService.terminateCluster(context);
sendEvent(context);
}
@Override
protected void initPayloadConverterMap(List<PayloadConverter<StackEvent>> payloadConverters) {
payloadConverters.add(new DisableKerberosResultToStackEventConverter());
}
@Override
protected Selectable createRequest(ClusterViewContext context) {
return new ClusterTerminationRequest(context.getStackId(), context.getClusterView() != null ? context.getClusterView().getId() : null);
}
};
}
use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterTerminationRequest in project cloudbreak by hortonworks.
the class ClusterTerminationHandler method accept.
@Override
public void accept(Event<ClusterTerminationRequest> event) {
ClusterTerminationRequest request = event.getData();
ClusterTerminationResult result;
try {
Boolean allowed = clusterTerminationService.deleteClusterComponents(request.getClusterId());
result = new ClusterTerminationResult(request, allowed);
} catch (RuntimeException e) {
LOGGER.error("Failed to delete cluster containers", e);
result = new ClusterTerminationResult(e.getMessage(), e, request);
}
eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Aggregations