use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class Jersey1TransportClientFactories method newTransportClientFactory.
@Deprecated
public TransportClientFactory newTransportClientFactory(final Collection<ClientFilter> additionalFilters, final EurekaJerseyClient providedJerseyClient) {
ApacheHttpClient4 apacheHttpClient = providedJerseyClient.getClient();
if (additionalFilters != null) {
for (ClientFilter filter : additionalFilters) {
if (filter != null) {
apacheHttpClient.addFilter(filter);
}
}
}
final TransportClientFactory jerseyFactory = new JerseyEurekaHttpClientFactory(providedJerseyClient, false);
final TransportClientFactory metricsFactory = MetricsCollectingEurekaHttpClient.createFactory(jerseyFactory);
return new TransportClientFactory() {
@Override
public EurekaHttpClient newClient(EurekaEndpoint serviceUrl) {
return metricsFactory.newClient(serviceUrl);
}
@Override
public void shutdown() {
metricsFactory.shutdown();
jerseyFactory.shutdown();
}
};
}
use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class Jersey1TransportClientFactories method newTransportClientFactory.
public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig, final Collection<ClientFilter> additionalFilters, final InstanceInfo myInstanceInfo) {
final TransportClientFactory jerseyFactory = JerseyEurekaHttpClientFactory.create(clientConfig, additionalFilters, myInstanceInfo, new EurekaClientIdentity(myInstanceInfo.getIPAddr()));
final TransportClientFactory metricsFactory = MetricsCollectingEurekaHttpClient.createFactory(jerseyFactory);
return new TransportClientFactory() {
@Override
public EurekaHttpClient newClient(EurekaEndpoint serviceUrl) {
return metricsFactory.newClient(serviceUrl);
}
@Override
public void shutdown() {
metricsFactory.shutdown();
jerseyFactory.shutdown();
}
};
}
use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class MetricsCollectingEurekaHttpClient method createFactory.
public static TransportClientFactory createFactory(final TransportClientFactory delegateFactory) {
final Map<RequestType, EurekaHttpClientRequestMetrics> metricsByRequestType = initializeMetrics();
final ExceptionsMetric exceptionMetrics = new ExceptionsMetric(EurekaClientNames.METRIC_TRANSPORT_PREFIX + "exceptions");
return new TransportClientFactory() {
@Override
public EurekaHttpClient newClient(EurekaEndpoint endpoint) {
return new MetricsCollectingEurekaHttpClient(delegateFactory.newClient(endpoint), metricsByRequestType, exceptionMetrics, false);
}
@Override
public void shutdown() {
shutdownMetrics(metricsByRequestType);
exceptionMetrics.shutdown();
}
};
}
use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class EurekaServerHttpClients method createRemoteRegionClient.
/**
* {@link EurekaHttpClient} for remote region replication.
*/
public static EurekaHttpClient createRemoteRegionClient(EurekaServerConfig serverConfig, EurekaTransportConfig transportConfig, ServerCodecs serverCodecs, ClusterResolver<EurekaEndpoint> clusterResolver) {
JerseyRemoteRegionClientFactory jerseyFactory = new JerseyRemoteRegionClientFactory(serverConfig, serverCodecs, clusterResolver.getRegion());
TransportClientFactory metricsFactory = MetricsCollectingEurekaHttpClient.createFactory(jerseyFactory);
SessionedEurekaHttpClient client = new SessionedEurekaHttpClient(Names.REMOTE, RetryableEurekaHttpClient.createFactory(Names.REMOTE, transportConfig, clusterResolver, createFactory(metricsFactory), ServerStatusEvaluators.legacyEvaluator()), RECONNECT_INTERVAL_MINUTES * 60 * 1000);
return client;
}
use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class AbstractJersey2EurekaHttpClientTest method getEurekaHttpClient.
@Override
protected EurekaHttpClient getEurekaHttpClient(URI serviceURI) {
Jersey2ApplicationClientFactoryBuilder factoryBuilder = Jersey2ApplicationClientFactory.newBuilder();
if (serviceURI.getUserInfo() != null) {
factoryBuilder.withFeature(HttpAuthenticationFeature.basicBuilder().build());
}
TransportClientFactory clientFactory = factoryBuilder.build();
jersey2HttpClient = (AbstractJersey2EurekaHttpClient) clientFactory.newClient(new DefaultEndpoint(serviceURI.toString()));
return jersey2HttpClient;
}
Aggregations