use of com.sequenceiq.cloudbreak.reactor.api.event.recipe.StackPreTerminationSuccess in project cloudbreak by hortonworks.
the class StackPreTerminationHandler method accept.
@Override
public void accept(Event<StackPreTerminationRequest> requestEvent) {
StackPreTerminationRequest request = requestEvent.getData();
Stack stack = stackService.getByIdWithLists(request.getStackId());
try {
Cluster cluster = stack.getCluster();
if (cluster != null) {
Set<HostGroup> hostGroups = hostGroupService.getByCluster(cluster.getId());
recipeEngine.executePreTerminationRecipes(stack, hostGroups);
}
} catch (Exception ex) {
LOGGER.error("Pre-termination failed: {}", ex.getMessage(), ex);
}
Selectable result = new StackPreTerminationSuccess(stack.getId());
eventBus.notify(result.selector(), new Event<>(requestEvent.getHeaders(), result));
}
Aggregations