Search in sources :

Example 1 with BootstrapNewNodesRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesRequest in project cloudbreak by hortonworks.

the class BootstrapNewNodesHandler method accept.

@Override
public void accept(Event<BootstrapNewNodesRequest> event) {
    BootstrapNewNodesRequest request = event.getData();
    BootstrapNewNodesResult result;
    try {
        clusterBootstrapper.bootstrapNewNodes(request.getStackId(), request.getUpscaleCandidateAddresses(), request.getHostNames());
        result = new BootstrapNewNodesResult(request);
    } catch (Exception e) {
        result = new BootstrapNewNodesResult(e.getMessage(), e, request);
    }
    eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Also used : BootstrapNewNodesResult(com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesResult) BootstrapNewNodesRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesRequest)

Example 2 with BootstrapNewNodesRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesRequest in project cloudbreak by hortonworks.

the class StackUpscaleActions method bootstrapNewNodes.

@Bean(name = "BOOTSTRAP_NEW_NODES_STATE")
public Action<?, ?> bootstrapNewNodes() {
    return new AbstractStackUpscaleAction<BootstrapNewNodesEvent>(BootstrapNewNodesEvent.class) {

        @Override
        protected void doExecute(StackScalingFlowContext context, BootstrapNewNodesEvent payload, Map<Object, Object> variables) {
            stackUpscaleService.bootstrappingNewNodes(context.getStack());
            Selectable request = new BootstrapNewNodesRequest(context.getStack().getId(), payload.getUpscaleCandidateAddresses(), context.getHostNames());
            sendEvent(context.getFlowId(), request);
        }
    };
}
Also used : Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) BootstrapNewNodesRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesRequest) Map(java.util.Map) StackScalingFlowContext(com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext) Bean(org.springframework.context.annotation.Bean)

Aggregations

BootstrapNewNodesRequest (com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesRequest)2 Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)1 StackScalingFlowContext (com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext)1 BootstrapNewNodesResult (com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesResult)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1