Search in sources :

Example 11 with ServiceDiscovered

use of org.apache.twill.discovery.ServiceDiscovered in project cdap by caskdata.

the class DefaultServiceManager method getServiceURL.

@Override
public URL getServiceURL(long timeout, TimeUnit timeoutUnit) {
    String discoveryName = String.format("service.%s.%s.%s", namespace, applicationId, serviceName);
    ServiceDiscovered discovered = discoveryServiceClient.discover(discoveryName);
    return createURL(new RandomEndpointStrategy(discovered).pick(timeout, timeoutUnit), applicationId, serviceName);
}
Also used : ServiceDiscovered(org.apache.twill.discovery.ServiceDiscovered) RandomEndpointStrategy(co.cask.cdap.common.discovery.RandomEndpointStrategy)

Aggregations

ServiceDiscovered (org.apache.twill.discovery.ServiceDiscovered)11 RandomEndpointStrategy (co.cask.cdap.common.discovery.RandomEndpointStrategy)7 EndpointStrategy (co.cask.cdap.common.discovery.EndpointStrategy)4 Discoverable (org.apache.twill.discovery.Discoverable)4 DiscoveryServiceClient (org.apache.twill.discovery.DiscoveryServiceClient)4 DatasetService (co.cask.cdap.data2.datafabric.dataset.service.DatasetService)2 AbstractModule (com.google.inject.AbstractModule)2 TransactionManager (org.apache.tephra.TransactionManager)2 TransactionSystemClient (org.apache.tephra.TransactionSystemClient)2 Test (org.junit.Test)2 LoggerContext (ch.qos.logback.classic.LoggerContext)1 Status (ch.qos.logback.core.status.Status)1 StatusListener (ch.qos.logback.core.status.StatusListener)1 StreamEvent (co.cask.cdap.api.flow.flowlet.StreamEvent)1 MetricsCollectionService (co.cask.cdap.api.metrics.MetricsCollectionService)1 ProgramDescriptor (co.cask.cdap.app.program.ProgramDescriptor)1 ProgramController (co.cask.cdap.app.runtime.ProgramController)1 ServiceStore (co.cask.cdap.app.store.ServiceStore)1 DatasetClient (co.cask.cdap.client.DatasetClient)1 MetadataClient (co.cask.cdap.client.MetadataClient)1