Package com.sequenceiq.cloudbreak.service.cluster.event

Examples of com.sequenceiq.cloudbreak.service.cluster.event.UpdateAmbariHostsSuccess


    @Autowired
    private InstanceMetaDataRepository metadataRepository;

    @Override
    public void accept(Event<UpdateAmbariHostsSuccess> event) {
        UpdateAmbariHostsSuccess data = event.getData();
        Cluster cluster = clusterRepository.findById(data.getClusterId());
        Set<String> hostNames = data.getHostNames();
        MDCBuilder.buildMdcContext(cluster);
        LOGGER.info("Accepted {} event.", ReactorConfig.UPDATE_AMBARI_HOSTS_SUCCESS_EVENT);
        Stack stack = stackRepository.findStackWithListsForCluster(data.getClusterId());
        for (String hostName : hostNames) {
            InstanceMetaData metadataEntry = metadataRepository.findHostInStack(stack.getId(), hostName);
            if (data.isDecommision()) {
                metadataEntry.setRemovable(true);
            } else {
                metadataEntry.setRemovable(false);
            }
            metadataRepository.save(metadataEntry);
        }
        stackUpdater.updateStackStatus(stack.getId(), Status.AVAILABLE, "");
        websocketService.sendToTopicUser(cluster.getOwner(), WebsocketEndPoint.CLUSTER,
                new StatusMessage(data.getClusterId(), cluster.getName(), Status.AVAILABLE.name()));
    }
View Full Code Here


    }

    private void updateHostSuccessful(Cluster cluster, Set<String> hostNames, boolean decommision) {
        MDCBuilder.buildMdcContext(cluster);
        LOGGER.info("Publishing {} event", ReactorConfig.UPDATE_AMBARI_HOSTS_SUCCESS_EVENT);
        reactor.notify(ReactorConfig.UPDATE_AMBARI_HOSTS_SUCCESS_EVENT, Event.wrap(new UpdateAmbariHostsSuccess(cluster.getId(), hostNames, decommision)));
    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.service.cluster.event.UpdateAmbariHostsSuccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.