Class RestClientTransportClientFactory
java.lang.Object
org.springframework.cloud.netflix.eureka.http.RestClientTransportClientFactory
- All Implemented Interfaces:
com.netflix.discovery.shared.transport.TransportClientFactory
public class RestClientTransportClientFactory
extends Object
implements com.netflix.discovery.shared.transport.TransportClientFactory
Provides the custom
RestClient required by the
RestClientEurekaHttpClient. Relies on Jackson for serialization and
deserialization.
A single ClientHttpRequestFactory (and the underlying HTTP client it wraps) is
lazily built on the first call to newClient(com.netflix.discovery.shared.resolver.EurekaEndpoint) and reused for every subsequent
call on this factory instance. Since each RestClientTransportClientFactory is
already scoped to a single Eureka client, caching the request factory here - rather
than in a potentially shared EurekaClientHttpRequestFactorySupplier - ties the
shared client's lifecycle directly to this factory instance, so shutdown()
only ever closes a client owned exclusively by this factory.
- Since:
- 4.2.0
- Author:
- Wonchul Heo, Olga Maciaszek-Sharma
-
Constructor Summary
ConstructorsConstructorDescriptionRestClientTransportClientFactory(Optional<SSLContext> sslContext, Optional<HostnameVerifier> hostnameVerifier, EurekaClientHttpRequestFactorySupplier eurekaClientHttpRequestFactorySupplier, Supplier<org.springframework.web.client.RestClient.Builder> builderSupplier) RestClientTransportClientFactory(org.springframework.cloud.configuration.TlsProperties tlsProperties, EurekaClientHttpRequestFactorySupplier eurekaClientHttpRequestFactorySupplier) RestClientTransportClientFactory(org.springframework.cloud.configuration.TlsProperties tlsProperties, EurekaClientHttpRequestFactorySupplier eurekaClientHttpRequestFactorySupplier, Supplier<org.springframework.web.client.RestClient.Builder> builderSupplier) -
Method Summary
-
Constructor Details
-
RestClientTransportClientFactory
public RestClientTransportClientFactory(Optional<SSLContext> sslContext, Optional<HostnameVerifier> hostnameVerifier, EurekaClientHttpRequestFactorySupplier eurekaClientHttpRequestFactorySupplier, Supplier<org.springframework.web.client.RestClient.Builder> builderSupplier) -
RestClientTransportClientFactory
public RestClientTransportClientFactory(org.springframework.cloud.configuration.TlsProperties tlsProperties, EurekaClientHttpRequestFactorySupplier eurekaClientHttpRequestFactorySupplier, Supplier<org.springframework.web.client.RestClient.Builder> builderSupplier) -
RestClientTransportClientFactory
public RestClientTransportClientFactory(org.springframework.cloud.configuration.TlsProperties tlsProperties, EurekaClientHttpRequestFactorySupplier eurekaClientHttpRequestFactorySupplier)
-
-
Method Details
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.netflix.discovery.shared.transport.TransportClientFactory