use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.
the class StopStartDownscaleFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(ClusterAndStackDownscaleTriggerEvent event) {
StackView stackView = stackService.getViewByIdWithoutAuth(event.getResourceId());
Map<String, Set<Long>> hostGroupsWithPrivateIds = event.getHostGroupsWithPrivateIds();
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
// TODO CB-14929: Is a stack sync really required here. What does it do ? (As of now it also serves to accept the event)
addStackSyncTriggerEvent(event, flowEventChain);
if (hostGroupsWithPrivateIds.keySet().size() > 1) {
throw new BadRequestException("Start stop downscale flow was intended to handle only 1 hostgroup.");
}
for (Map.Entry<String, Set<Long>> hostGroupWithPrivateIds : hostGroupsWithPrivateIds.entrySet()) {
StopStartDownscaleTriggerEvent te = new StopStartDownscaleTriggerEvent(StopStartDownscaleEvent.STOPSTART_DOWNSCALE_TRIGGER_EVENT.event(), stackView.getId(), hostGroupWithPrivateIds.getKey(), hostGroupWithPrivateIds.getValue());
flowEventChain.add(te);
}
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.
the class SyncFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(StackEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackSyncTriggerEvent(STACK_SYNC_EVENT.event(), event.getResourceId(), true, event.accepted()));
flowEventChain.add(new StackEvent(CLUSTER_SYNC_EVENT.event(), event.getResourceId()));
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.
the class UpscaleFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(StackAndClusterUpscaleTriggerEvent event) {
StackView stackView = stackService.getViewByIdWithoutAuth(event.getResourceId());
ClusterView clusterView = stackView.getClusterView();
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
addStackSyncTriggerEvent(event, flowEventChain);
addStackScaleTriggerEvent(event, flowEventChain);
addClusterScaleTriggerEventIfNeeded(event, stackView, clusterView, flowEventChain);
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.
the class MultiHostgroupDownscaleFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(MultiHostgroupClusterAndStackDownscaleTriggerEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new FlowChainInitPayload(getName(), event.getResourceId(), event.accepted()));
ClusterScaleTriggerEvent cste = new ClusterDownscaleTriggerEvent(DECOMMISSION_EVENT.event(), event.getResourceId(), Collections.emptyMap(), event.getPrivateIdsByHostgroupMap(), Collections.emptyMap(), event.accepted(), event.getDetails());
flowEventChain.add(cste);
if (event.getScalingType() == ScalingType.DOWNSCALE_TOGETHER) {
CloudPlatformVariant cloudPlatformVariant = stackService.getPlatformVariantByStackId(event.getResourceId());
StackScaleTriggerEvent sste = new StackDownscaleTriggerEvent(STACK_DOWNSCALE_EVENT.event(), event.getResourceId(), Collections.emptyMap(), event.getPrivateIdsByHostgroupMap(), Collections.emptyMap(), cloudPlatformVariant.getVariant().value());
flowEventChain.add(sste);
}
flowEventChain.add(new FlowChainFinalizePayload(getName(), event.getResourceId(), event.accepted()));
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.
the class ProperTerminationFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(TerminationEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new TerminationEvent(ClusterTerminationEvent.PROPER_TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType()));
flowEventChain.add(new TerminationEvent(START_EXTERNAL_DATABASE_TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType()));
flowEventChain.add(new TerminationEvent(StackTerminationEvent.TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType(), event.accepted()));
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Aggregations