Search in sources :

Example 1 with ClusterRecoveryTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.ClusterRecoveryTriggerEvent in project cloudbreak by hortonworks.

the class DatalakeRecoveryBringupActions method datalakeRecoveryRestoreComponents.

@Bean(name = "RECOVERY_RESTORE_COMPONENTS_STATE")
public Action<?, ?> datalakeRecoveryRestoreComponents() {
    return new AbstractDatalakeRecoveryBringupAction<>(ClusterRecoveryTriggerEvent.class) {

        @Override
        protected void doExecute(DatalakeRecoveryBringupContext context, ClusterRecoveryTriggerEvent payload, Map<Object, Object> variables) {
            Long stackId = context.getStackId();
            try {
                Image image = componentConfigProviderService.getImage(stackId);
                imageComponentUpdaterService.updateForUpgrade(image.getImageId(), stackId);
            } catch (CloudbreakImageNotFoundException e) {
                String message = "Image was not found for current stack, it is not possible to continue recovery. " + "Please open a Cloudera support ticket to fix this issue";
                LOGGER.warn(message);
                throw new CloudbreakServiceException(message);
            }
            sendEvent(context, RECOVERY_RESTORE_COMPONENTS_FINISHED_EVENT.event(), payload);
        }
    };
}
Also used : CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) ClusterRecoveryTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterRecoveryTriggerEvent) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 2 with ClusterRecoveryTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.ClusterRecoveryTriggerEvent 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);
}
Also used : FlowChainInitPayload(com.sequenceiq.flow.core.chain.init.flowevents.FlowChainInitPayload) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) FlowChainFinalizePayload(com.sequenceiq.flow.core.chain.finalize.flowevents.FlowChainFinalizePayload) ClusterRecoveryTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterRecoveryTriggerEvent) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) TerminationEvent(com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent)

Aggregations

ClusterRecoveryTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterRecoveryTriggerEvent)2 Image (com.sequenceiq.cloudbreak.cloud.model.Image)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 TerminationEvent (com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 FlowChainFinalizePayload (com.sequenceiq.flow.core.chain.finalize.flowevents.FlowChainFinalizePayload)1 FlowChainInitPayload (com.sequenceiq.flow.core.chain.init.flowevents.FlowChainInitPayload)1 Map (java.util.Map)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 Bean (org.springframework.context.annotation.Bean)1