Search in sources :

Example 1 with ClusterProxyReRegistrationRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyReRegistrationRequest in project cloudbreak by hortonworks.

the class StackUpscaleActions method reRegisterWithClusterProxy.

@Bean(name = "RE_REGISTER_WITH_CLUSTER_PROXY_STATE")
public Action<?, ?> reRegisterWithClusterProxy() {
    return new AbstractStackUpscaleAction<>(StackEvent.class) {

        @Inject
        private ClusterProxyEnablementService clusterProxyEnablementService;

        @Override
        protected void doExecute(StackScalingFlowContext context, StackEvent payload, Map<Object, Object> variables) {
            if (clusterProxyEnablementService.isClusterProxyApplicable(context.getStack().cloudPlatform())) {
                stackUpscaleService.reRegisterWithClusterProxy(context.getStack().getId());
                sendEvent(context);
            } else {
                LOGGER.info("Cluster Proxy integration is DISABLED, skipping re-registering with Cluster Proxy service");
                StackEvent bootstrapNewNodesEvent = new StackEvent(StackUpscaleEvent.CLUSTER_PROXY_RE_REGISTRATION_FINISHED_EVENT.event(), payload.getResourceId());
                sendEvent(context, bootstrapNewNodesEvent);
            }
        }

        @Override
        protected Selectable createRequest(StackScalingFlowContext context) {
            return new ClusterProxyReRegistrationRequest(context.getStack().getId(), context.getStack().getCloudPlatform(), StackUpscaleEvent.CLUSTER_PROXY_RE_REGISTRATION_FINISHED_EVENT.event());
        }
    };
}
Also used : ClusterProxyReRegistrationRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyReRegistrationRequest) ClusterProxyEnablementService(com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) Map(java.util.Map) HashMap(java.util.HashMap) StackScalingFlowContext(com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext) Bean(org.springframework.context.annotation.Bean)

Example 2 with ClusterProxyReRegistrationRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyReRegistrationRequest in project cloudbreak by hortonworks.

the class ClusterProxyReRegistrationHandler method accept.

@Override
public void accept(Event<ClusterProxyReRegistrationRequest> event) {
    ClusterProxyReRegistrationRequest request = event.getData();
    Selectable response = registerCluster(request);
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : ClusterProxyReRegistrationRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyReRegistrationRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable)

Aggregations

ClusterProxyReRegistrationRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyReRegistrationRequest)2 ClusterProxyEnablementService (com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 StackScalingFlowContext (com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1