Search in sources :

Example 1 with ClusterSyncRequest

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

the class ClusterSyncHandler method accept.

@Override
public void accept(Event<ClusterSyncRequest> event) {
    ClusterSyncRequest request = event.getData();
    ClusterSyncResult result;
    try {
        Stack stack = stackService.getByIdWithLists(request.getStackId());
        String proxyIp = stackUtil.extractAmbariIp(stack);
        String contextPath = stack.getCluster().getGateway().getPath();
        proxyRegistrator.register(stack.getName(), contextPath, proxyIp);
        Cluster cluster = clusterService.retrieveClusterByStackId(request.getStackId());
        ambariClusterStatusUpdater.updateClusterStatus(stack, cluster);
        result = new ClusterSyncResult(request);
    } catch (Exception e) {
        result = new ClusterSyncResult(e.getMessage(), e, request);
    }
    eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Also used : ClusterSyncRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterSyncRequest) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) ClusterSyncResult(com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterSyncResult) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Aggregations

Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 ClusterSyncRequest (com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterSyncRequest)1 ClusterSyncResult (com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterSyncResult)1