public interface HttpClient extends HttpRequester, GracefulAutoCloseable
HttpConnection instances and distribute calls to request(HttpRequest) amongst this collection.| Modifier and Type | Method and Description |
|---|---|
default BlockingHttpClient |
asBlockingClient()
Convert this
HttpClient to the BlockingHttpClient API. |
default BlockingStreamingHttpClient |
asBlockingStreamingClient()
Convert this
HttpClient to the BlockingStreamingHttpClient API. |
StreamingHttpClient |
asStreamingClient()
Convert this
HttpClient to the StreamingHttpClient API. |
default void |
close() |
default void |
closeGracefully()
Used to close/shutdown a resource, similar to
AutoCloseable.close(), but attempts to cleanup state before
abruptly closing. |
Single<HttpResponse> |
request(HttpRequest request)
Send a
request. |
Single<ReservedHttpConnection> |
reserveConnection(HttpExecutionStrategy strategy,
HttpRequestMetaData metaData)
Reserve an
HttpConnection based on provided HttpRequestMetaData. |
Single<ReservedHttpConnection> |
reserveConnection(HttpRequestMetaData metaData)
Reserve an
HttpConnection based on provided HttpRequestMetaData. |
executionContext, httpResponseFactory, requestconnect, delete, get, head, newRequest, options, patch, post, put, traceonClosecloseAsync, closeAsyncGracefullySingle<HttpResponse> request(HttpRequest request)
request.request - the request to send.Single<ReservedHttpConnection> reserveConnection(HttpRequestMetaData metaData)
HttpConnection based on provided HttpRequestMetaData.metaData - Allows the underlying layers to know what HttpConnections are valid to
reserve for future requests with the same HttpRequestMetaData.
For example this may provide some insight into shard or other info.Single that provides the ReservedHttpConnection upon completion.Single<ReservedHttpConnection> reserveConnection(HttpExecutionStrategy strategy, HttpRequestMetaData metaData)
HttpConnection based on provided HttpRequestMetaData.
Note: reserved connections may not be restricted by the max pipelined requests count.
strategy - HttpExecutionStrategy to use.metaData - Allows the underlying layers to know what HttpConnections are valid to
reserve for future requests with the same HttpRequestMetaData.
For example this may provide some insight into shard or other info.Single that provides the ReservedHttpConnection upon completion.StreamingHttpClient asStreamingClient()
HttpClient to the StreamingHttpClient API.StreamingHttpClient representation of this HttpClient.default BlockingStreamingHttpClient asBlockingStreamingClient()
HttpClient to the BlockingStreamingHttpClient API.BlockingStreamingHttpClient representation of this HttpClient.default BlockingHttpClient asBlockingClient()
HttpClient to the BlockingHttpClient API.BlockingHttpClient representation of this HttpClient.default void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exceptiondefault void closeGracefully()
throws java.lang.Exception
GracefulAutoCloseableAutoCloseable.close(), but attempts to cleanup state before
abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in
flight work. This method is implemented on a "best effort" basis and may be equivalent to AutoCloseable.close().
Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not
want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a
timeout and force a call to AutoCloseable.close().
closeGracefully in interface GracefulAutoCloseablejava.lang.Exception - if graceful closure failed.