Search in sources :

Example 1 with ClusterProxyGatewayRegistrationSuccess

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

the class ClusterProxyGatewayRegistrationHandler method accept.

@Override
public void accept(Event<ClusterProxyGatewayRegistrationRequest> event) {
    ClusterProxyGatewayRegistrationRequest request = event.getData();
    Selectable response;
    try {
        if (clusterProxyEnablementService.isClusterProxyApplicable(request.getCloudPlatform())) {
            clusterProxyService.registerGatewayConfiguration(request.getResourceId());
            response = new ClusterProxyGatewayRegistrationSuccess(request.getResourceId());
        } else {
            LOGGER.info("Cluster Proxy integration is DISABLED, skipping registering gateway configuration with Cluster Proxy service.");
            response = new ClusterProxyGatewayRegistrationSuccess(request.getResourceId());
        }
    } catch (Exception e) {
        LOGGER.error("Error occurred when registering gateway config with cluster proxy", e);
        response = new ClusterProxyGatewayRegistrationFailed(request.getResourceId(), e);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : ClusterProxyGatewayRegistrationFailed(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyGatewayRegistrationFailed) ClusterProxyGatewayRegistrationSuccess(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyGatewayRegistrationSuccess) ClusterProxyGatewayRegistrationRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyGatewayRegistrationRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable)

Aggregations

Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 ClusterProxyGatewayRegistrationFailed (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyGatewayRegistrationFailed)1 ClusterProxyGatewayRegistrationRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyGatewayRegistrationRequest)1 ClusterProxyGatewayRegistrationSuccess (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyGatewayRegistrationSuccess)1