use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class EphemeralClusterUpdateHandler method accept.
@Override
public void accept(Event<EphemeralClusterUpdateRequest> event) {
EphemeralClusterUpdateRequest request = event.getData();
Selectable response;
try {
clusterServiceRunner.updateSaltState(request.getStackId());
response = new EphemeralClusterUpdateSuccess(request.getStackId());
} catch (Exception e) {
response = new EphemeralClusterUpdateFailed(request.getStackId(), 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 StackDownscaleActions method stackDownscaleAction.
@Bean(name = "DOWNSCALE_STATE")
public Action<?, ?> stackDownscaleAction() {
return new AbstractStackDownscaleAction<DownscaleStackCollectResourcesResult>(DownscaleStackCollectResourcesResult.class) {
@Override
protected void doExecute(StackScalingFlowContext context, DownscaleStackCollectResourcesResult payload, Map<Object, Object> variables) {
Selectable request = new DownscaleStackRequest(context.getCloudContext(), context.getCloudCredential(), context.getCloudStack(), (List<CloudResource>) variables.get(RESOURCES), (List<CloudInstance>) variables.get(INSTANCES), payload.getResourcesToScale());
sendEvent(context.getFlowId(), request);
}
};
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayActions method repairGatewayAction.
@Bean(name = "CHANGE_PRIMARY_GATEWAY_STATE")
public Action<?, ?> repairGatewayAction() {
return new AbstractClusterAction<ChangePrimaryGatewayTriggerEvent>(ChangePrimaryGatewayTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, ChangePrimaryGatewayTriggerEvent payload, Map<Object, Object> variables) {
changePrimaryGatewayService.changePrimaryGatewayStarted(context.getStackId());
Selectable request = new ChangePrimaryGatewayRequest(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 collectCandidatesAction.
@Bean(name = "COLLECT_CANDIDATES_STATE")
public Action<?, ?> collectCandidatesAction() {
return new AbstractClusterAction<ClusterDownscaleTriggerEvent>(ClusterDownscaleTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, ClusterDownscaleTriggerEvent payload, Map<Object, Object> variables) {
clusterDownscaleService.clusterDownscaleStarted(context.getStackId(), payload.getHostGroupName(), payload.getAdjustment(), payload.getHostNames());
Selectable request = new CollectDownscaleCandidatesRequest(context.getStackId(), payload.getHostGroupName(), payload.getAdjustment(), payload.getHostNames());
sendEvent(context.getFlowId(), request.selector(), request);
}
};
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class FlowChains method triggerNextFlow.
public void triggerNextFlow(String flowChainId) {
Queue<Selectable> queue = flowChainMap.get(flowChainId);
if (queue != null) {
Selectable selectable = queue.poll();
if (selectable != null) {
sendEvent(flowChainId, selectable);
} else {
removeFlowChain(flowChainId);
triggerParentFlowChain(flowChainId);
}
flowLogService.saveChain(flowChainId, flowChainParentMap.get(flowChainId), queue);
}
}
Aggregations