Search in sources :

Example 1 with BootstrapNewNodesResult

use of com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesResult 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 BootstrapNewNodesResult

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

the class StackUpscaleActions method extendHostMetadata.

@Bean(name = "EXTEND_HOST_METADATA_STATE")
public Action<?, ?> extendHostMetadata() {
    return new AbstractStackUpscaleAction<BootstrapNewNodesResult>(BootstrapNewNodesResult.class) {

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

Aggregations

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