Search in sources :

Example 1 with StartClusterSuccess

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterSuccess in project cloudbreak by hortonworks.

the class ResetFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(StackEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    flowEventChain.add(new StackEvent(CLUSTER_RESET_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new StartClusterSuccess(CLUSTER_INSTALL_EVENT.event(), event.getResourceId()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) StartClusterSuccess(com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterSuccess) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 2 with StartClusterSuccess

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterSuccess in project cloudbreak by hortonworks.

the class StartClusterHandler method accept.

@Override
public void accept(Event<StartClusterRequest> event) {
    Long stackId = event.getData().getResourceId();
    Selectable response;
    try {
        clusterBuilderService.startCluster(stackId);
        response = new StartClusterSuccess(stackId);
    } catch (Exception e) {
        response = new StartClusterFailed(stackId, e);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) StartClusterSuccess(com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterSuccess) StartClusterFailed(com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterFailed)

Aggregations

Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)2 StartClusterSuccess (com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterSuccess)2 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 StartClusterFailed (com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartClusterFailed)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1