use of com.sequenceiq.flow.core.chain.init.flowevents.FlowChainInitPayload 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.init.flowevents.FlowChainInitPayload in project cloudbreak by hortonworks.
the class ClusterRepairFlowEventChainFactory method createFlowTriggers.
private Queue<Selectable> createFlowTriggers(ClusterRepairTriggerEvent event, RepairConfig repairConfig) {
Queue<Selectable> flowTriggers = new ConcurrentLinkedDeque<>();
flowTriggers.add(new FlowChainInitPayload(getName(), event.getResourceId(), event.accepted()));
Map<String, Set<String>> repairableGroupsWithHostNames = new HashMap<>();
boolean singlePrimaryGW = fillRepairableGroupsWithHostNames(repairConfig, repairableGroupsWithHostNames);
LOGGER.info("Repairable groups with host names: {}", repairableGroupsWithHostNames);
addDownscaleAndUpscaleEvents(event, flowTriggers, repairableGroupsWithHostNames, singlePrimaryGW);
flowTriggers.add(rescheduleStatusCheckEvent(event));
flowTriggers.add(new FlowChainFinalizePayload(getName(), event.getResourceId(), event.accepted()));
return flowTriggers;
}
use of com.sequenceiq.flow.core.chain.init.flowevents.FlowChainInitPayload in project cloudbreak by hortonworks.
the class RecoverDatalakeFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(ClusterRecoveryTriggerEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new FlowChainInitPayload(getName(), event.getResourceId(), event.accepted()));
flowEventChain.add(new TerminationEvent(FlowChainTriggers.RECOVERY_TERMINATION_TRIGGER_EVENT, event.getResourceId(), TerminationType.RECOVERY));
flowEventChain.add(new ClusterRecoveryTriggerEvent(RECOVERY_BRINGUP_EVENT.event(), event.getResourceId(), event.accepted()));
flowEventChain.add(new StackEvent(FlowChainTriggers.RECOVERY_PROVISION_TRIGGER_EVENT, event.getResourceId(), event.accepted()));
flowEventChain.add(new FlowChainFinalizePayload(getName(), event.getResourceId(), event.accepted()));
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Aggregations