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));
}
Aggregations