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);
}
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class ProperTerminationFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(TerminationEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(ClusterTerminationEvent.PROPER_TERMINATION_EVENT.event(), event.getStackId(), null));
flowEventChain.add(new TerminationEvent(StackTerminationEvent.TERMINATION_EVENT.event(), event.getStackId(), event.getForced(), event.getDeleteDependencies()));
return flowEventChain;
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class ProvisionFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(StackEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(START_CREATION_EVENT.event(), event.getStackId(), event.accepted()));
flowEventChain.add(new StackEvent(CLUSTER_CREATION_EVENT.event(), event.getStackId()));
return flowEventChain;
}
Aggregations