Package io.micronaut.http.client
Interface HttpClientRegistry<T extends HttpClient>
- Type Parameters:
T
- Reactive HTTP Client
- All Known Implementing Classes:
DefaultJdkHttpClientRegistry
,DefaultNettyHttpClientRegistry
public interface HttpClientRegistry<T extends HttpClient>
Interface for managing the construction and lifecycle of instances of
HttpClient
clients.- Since:
- 3.0.0
- Author:
- Sergio del Amo
-
Method Summary
Modifier and TypeMethodDescriptionvoid
disposeClient
(AnnotationMetadata annotationMetadata) Dispose of the client defined by the given metadata.getClient
(@NonNull AnnotationMetadata annotationMetadata) Return the client for the given annotation metadata.getClient
(@NonNull HttpVersionSelection httpVersion, @NonNull String clientId, @Nullable String path) Return the client for the client ID and path.default T
Deprecated.default T
resolveClient
(@Nullable InjectionPoint<?> injectionPoint, @Nullable LoadBalancer loadBalancer, @Nullable HttpClientConfiguration configuration, @NonNull BeanContext beanContext) Resolves aHttpClient
for the given injection point.
-
Method Details
-
getClient
Return the client for the given annotation metadata.- Parameters:
annotationMetadata
- The annotation metadata.- Returns:
- The client
-
getClient
@Deprecated @NonNull default T getClient(HttpVersion httpVersion, @NonNull @NonNull String clientId, @Nullable @Nullable String path) Deprecated.UsegetClient(HttpVersionSelection, String, String)
insteadReturn the client for the client ID and path.- Parameters:
httpVersion
- The HTTP versionclientId
- The client IDpath
- The path (Optional)- Returns:
- The client
-
getClient
@NonNull T getClient(@NonNull @NonNull HttpVersionSelection httpVersion, @NonNull @NonNull String clientId, @Nullable @Nullable String path) Return the client for the client ID and path.- Parameters:
httpVersion
- The HTTP versionclientId
- The client IDpath
- The path (Optional)- Returns:
- The client
- Since:
- 4.0.0
-
resolveClient
@NonNull T resolveClient(@Nullable @Nullable InjectionPoint<?> injectionPoint, @Nullable @Nullable LoadBalancer loadBalancer, @Nullable @Nullable HttpClientConfiguration configuration, @NonNull @NonNull BeanContext beanContext) Resolves aHttpClient
for the given injection point.- Parameters:
injectionPoint
- The injection pointloadBalancer
- The load balancer to use (Optional)configuration
- The configuration (Optional)beanContext
- The bean context to use- Returns:
- The HTTP Client
-
disposeClient
Dispose of the client defined by the given metadata.- Parameters:
annotationMetadata
- The annotation metadata
-
getDefaultClient
- Returns:
- Return the default HTTP client.
-
getClient(HttpVersionSelection, String, String)
instead