Examples of DiscoveryClient


Examples of com.netflix.discovery.DiscoveryClient

        ruleEngine = new ConformityRuleEngine();
        boolean eurekaEnabled = configuration().getBoolOrElse("simianarmy.conformity.Eureka.enabled", false);

        if (eurekaEnabled) {
            LOGGER.info("Initializing Discovery client.");
            DiscoveryClient discoveryClient = DiscoveryManager.getInstance().getDiscoveryClient();
            ConformityEurekaClient conformityEurekaClient = new BasicConformityEurekaClient(discoveryClient);
            if (configuration().getBoolOrElse(
                    "simianarmy.conformity.rule.InstanceIsHealthyInEureka.enabled", false)) {
                ruleEngine.addRule(new InstanceIsHealthyInEureka(conformityEurekaClient));
            }
View Full Code Here

Examples of com.netflix.discovery.DiscoveryClient

    @GET
    public Response getEurekaDetails() {
        List<EurekaInstanceInfo> instanceInfoList = new ArrayList<EurekaInstanceInfo>();

        DiscoveryClient discoveryClient = DiscoveryManager.getInstance().getDiscoveryClient();
        if (null != discoveryClient) {
            Applications apps = discoveryClient.getApplications();
            for (Application app : apps.getRegisteredApplications()) {
                for (InstanceInfo inst : app.getInstances()) {
                    instanceInfoList.add(new EurekaInstanceInfo(inst.getAppName(), inst.getId(), inst.getStatus().name(), inst.getIPAddr(), inst.getHostName()));
                }
            }
View Full Code Here

Examples of com.netflix.discovery.DiscoveryClient

        ConfigurationManager.getConfigInstance().setProperty("eureka.serviceUrl.default",
                                                             "http://localhost:" + mockRemoteEurekaServer.getPort() +
                                                             MockRemoteEurekaServer.EUREKA_API_BASE_PATH);

        client = new DiscoveryClient(builder.build(), new DefaultEurekaClientConfig());
        ApplicationInfoManager.getInstance().initComponent(new MyDataCenterInstanceConfig());
        registry = new PeerAwareInstanceRegistry() {

            @Override
            public boolean isLeaseExpirationEnabled() {
View Full Code Here

Examples of com.netflix.discovery.DiscoveryClient

    }

    @Override
    public List<Host> get() {

        DiscoveryClient discoveryClient = DiscoveryManager.getInstance().getDiscoveryClient();
        if (discoveryClient == null) {
            LOG.error("Error getting discovery client");
            throw new RuntimeException("Failed to create discovery client");
        }

        Application app = discoveryClient.getApplication(applicationName);
        List<Host> hosts = Lists.newArrayList();
       
        if (app == null) {
            return hosts;
        }
View Full Code Here

Examples of com.netflix.discovery.DiscoveryClient

       
        // naive implementation where we loop through all instances in discovery
        // no need to raise any exceptions here, just return localhost if there
        // is any error
        //TODO: use injection instead of getInstance
        final DiscoveryClient discoveryClient = DiscoveryManager.getInstance()
                .getDiscoveryClient();
        if (discoveryClient == null) {
            LOG.warn("Can't instantiate DiscoveryClient - returning localhost");
            return localhost;
        }
        final Application app = discoveryClient.getApplication(appName);
        if (app == null) {
            LOG.warn("Discovery client can't find genie - returning localhost");
            return localhost;
        }
View Full Code Here

Examples of org.rzo.netty.mcast.discovery.DiscoveryClient

    bootstrap.setOption("reuseAddress", true);

    // if we do not have a port: use discovery
    if (port == 0)
    {
      discovery = new DiscoveryClient();
      bootstrap.setPipelineFactory(new AHessianClientPipelineFactory(executor, factory, null));

      discovery.setName(discoveryName);
      discovery.addListener(new DiscoveryListener()
      {
View Full Code Here

Examples of org.wso2.carbon.discovery.client.DiscoveryClient

        ConfigurationContext cfgCtx = ConfigHolder.getInstance().getClientConfigurationContext();
        String proxyURL = properties.getProperty(DISCOVERY_PROXY_URL);
        if (proxyURL == null) {
            throw new DiscoveryException("The discovery proxy URL is not specified");
        }
        DiscoveryClient client = new DiscoveryClient(cfgCtx, proxyURL);
        TargetService service = client.resolve(uuid);
        client.cleanup();
        return getEndpointFromService(service, protocol);
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.client.DiscoveryClient

        if (pd.getScopes() != null) {
            scopes = Util.toURIArray(pd.getScopes());
        }

        DiscoveryClient client = new DiscoveryClient(
                ConfigHolder.getInstance().getClientConfigurationContext(), proxy.getUrl());
        if (proxy.getPolicy() != null) {
            client.engageModule("rampart");
            client.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
                    getPolicy(proxy.getPolicy(), registry));
        }
        TargetService[] services = client.probe(types, scopes, pd.getRule());
        client.cleanup();
        return services;
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.client.DiscoveryClient

        DiscoveryProxyDetails proxy = getDiscoveryProxy(name, registry);
        if (proxy == null) {
            throw new DiscoveryException("No discovery proxy exists by the name " + name);
        }

        DiscoveryClient client = new DiscoveryClient(
                ConfigHolder.getInstance().getClientConfigurationContext(), proxy.getUrl());
        if (proxy.getPolicy() != null) {
            client.engageModule("rampart");
            client.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
                    getPolicy(proxy.getPolicy(), registry));
        }
        TargetService service = client.resolve(id);
        client.cleanup();
        return service;
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.client.DiscoveryClient

            try {
                for (int i = 0; i < scopes.length; i++) {
                    uriScopes[i] = new URI(scopes[i]);
                }
                DiscoveryClient discoveryClient = new DiscoveryClient(messageContext.getConfigurationContext(), discoveryProxy);
                TargetService[] targetServices = discoveryClient.probe(types, uriScopes);
                if ((targetServices != null) && (targetServices.length > 0)) {

                    // currently we try to use the first one.
                    URI targetURI = null;
                    if ((targetServices[0].getXAddresses() != null) && (targetServices[0].getXAddresses().length > 0)) {
                        targetURI = getTargetURI(targetServices[0].getXAddresses(),
                                (String) messageContext.getProperty(DiscoveryConstants.DISCOVERY_SCHEME));
                    } else {
                        // get the epr using a resolve request
                        TargetService targetService = discoveryClient.resolve(targetServices[0].getEpr().getAddress());
                        if ((targetService.getXAddresses() != null) && (targetService.getXAddresses().length > 0)) {
                            targetURI = getTargetURI(targetService.getXAddresses(),
                                    (String) messageContext.getProperty(DiscoveryConstants.DISCOVERY_SCHEME));
                        } else {
                            throw new AxisFault("Resolve message did not return the service location");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.