use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class FlowChainHandler method restoreFlowChain.
public void restoreFlowChain(String flowChainId) {
FlowChainLog chainLog = flowChainLogRepository.findFirstByFlowChainIdOrderByCreatedDesc(flowChainId);
if (chainLog != null) {
Queue<Selectable> chain = (Queue<Selectable>) JsonReader.jsonToJava(chainLog.getChain());
flowChains.putFlowChain(flowChainId, chainLog.getParentFlowChainId(), chain);
if (chainLog.getParentFlowChainId() != null) {
restoreFlowChain(chainLog.getParentFlowChainId());
}
}
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class EphemeralClusterActions method updateNameserverAction.
@Bean(name = "EPHEMERAL_CLUSTER_UPDATE_STATE")
public Action<?, ?> updateNameserverAction() {
return new AbstractClusterAction<EphemeralClusterUpdateTriggerEvent>(EphemeralClusterUpdateTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, EphemeralClusterUpdateTriggerEvent payload, Map<Object, Object> variables) {
ephemeralClusterService.updateClusterStarted(context.getStackId());
Selectable request = new EphemeralClusterUpdateRequest(context.getStackId());
sendEvent(context.getFlowId(), request.selector(), request);
}
};
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class ClusterDownscaleActions method decommissionAction.
@Bean(name = "DECOMMISSION_STATE")
public Action<?, ?> decommissionAction() {
return new AbstractClusterAction<CollectDownscaleCandidatesResult>(CollectDownscaleCandidatesResult.class) {
@Override
protected void doExecute(ClusterViewContext context, CollectDownscaleCandidatesResult payload, Map<Object, Object> variables) {
Selectable request = new DecommissionRequest(context.getStackId(), payload.getHostGroupName(), payload.getHostNames());
sendEvent(context.getFlowId(), request.selector(), request);
}
};
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class WaitingAmbariServerHandler method accept.
@Override
public void accept(Event<WaitForAmbariServerRequest> event) {
Long stackId = event.getData().getStackId();
Selectable response;
try {
Stack stack = stackService.getById(stackId);
ambariClusterConnector.waitForServer(stack);
response = new WaitForAmbariServerSuccess(stackId);
} catch (Exception e) {
response = new WaitForAmbariServerFailed(stackId, e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class BootstrapMachineHandler method accept.
@Override
public void accept(Event<BootstrapMachinesRequest> event) {
BootstrapMachinesRequest request = event.getData();
Selectable response;
try {
clusterBootstrapper.bootstrapMachines(request.getStackId());
response = new BootstrapMachinesSuccess(request.getStackId());
} catch (Exception e) {
response = new BootstrapMachinesFailed(request.getStackId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Aggregations