Package io.vertx.rxjava3.core.http

## Class HttpClientAgent

- java.lang.Object
- - io.vertx.rxjava3.core.http.HttpClientAgent

- All Implemented Interfaces:
    `io.vertx.lang.rx.RxDelegate`, `HttpClient`, `Measured`

      public class HttpClientAgent
      extends Object
      implements io.vertx.lang.rx.RxDelegate, HttpClient, Measured

  An asynchronous HTTP client.

  It allows you to make requests to HTTP servers, and a single client can make requests to any server.

  The client can also pool HTTP connections.

  For pooling to occur, keep-alive must be true on the `HttpClientOptions` (default is true). In this case connections will be pooled and re-used if there are pending HTTP requests waiting to get a connection, otherwise they will be closed.

  This gives the benefits of keep alive when the client is loaded but means we don't keep connections hanging around unnecessarily when there would be no benefits anyway.

  The client also supports pipe-lining of requests. Pipe-lining means another request is sent on the same connection before the response from the preceding one has returned. Pipe-lining is not appropriate for all requests.

  To enable pipe-lining, it must be enabled on the `HttpClientOptions` (default is false).

  When pipe-lining is enabled the connection will be automatically closed when all in-flight responses have returned and there are no outstanding pending requests to write.

  The client is designed to be reused between requests.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<HttpClientAgent>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HttpClientAgent​(HttpClientAgent delegate)` |
    `HttpClientAgent​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Completable` | `close()` | Close immediately (`shutdown(0, TimeUnit.SECONDS`).
    `Single<HttpClientConnection>` | `connect​(HttpConnectOptions options)` | Connect to a remote HTTP server with the specific `options`, the connection is un-pooled and the management of the connection is left to the user.
    `boolean` | `equals​(Object o)` |
    `HttpClientAgent` | `getDelegate()` |
    `int` | `hashCode()` |
    `boolean` | `isMetricsEnabled()` | Whether the metrics are enabled for this measured object
    `static HttpClientAgent` | `newInstance​(HttpClientAgent arg)` |
    `Single<HttpClientRequest>` | `request()` | Create an HTTP request to send to the server with the default host and port of the client.
    `Single<HttpClientRequest>` | `request​(HttpMethod method, int port, String host, String requestURI)` | Create an HTTP request to send to the server at the `host` and `port`.
    `Single<HttpClientRequest>` | `request​(HttpMethod method, String requestURI)` | Create an HTTP request to send to the server at the default host and port.
    `Single<HttpClientRequest>` | `request​(HttpMethod method, String host, String requestURI)` | Create an HTTP request to send to the server at the `host` and default port.
    `Single<HttpClientRequest>` | `request​(RequestOptions options)` | Create an HTTP request to send to the server.
    `Completable` | `rxClose()` | Close immediately (`shutdown(0, TimeUnit.SECONDS`).
    `Single<HttpClientConnection>` | `rxConnect​(HttpConnectOptions options)` | Connect to a remote HTTP server with the specific `options`, the connection is un-pooled and the management of the connection is left to the user.
    `Single<HttpClientRequest>` | `rxRequest()` | Create an HTTP request to send to the server with the default host and port of the client.
    `Single<HttpClientRequest>` | `rxRequest​(HttpMethod method, int port, String host, String requestURI)` | Create an HTTP request to send to the server at the `host` and `port`.
    `Single<HttpClientRequest>` | `rxRequest​(HttpMethod method, String requestURI)` | Create an HTTP request to send to the server at the default host and port.
    `Single<HttpClientRequest>` | `rxRequest​(HttpMethod method, String host, String requestURI)` | Create an HTTP request to send to the server at the `host` and default port.
    `Single<HttpClientRequest>` | `rxRequest​(RequestOptions options)` | Create an HTTP request to send to the server.
    `Completable` | `rxShutdown()` | Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
    `Completable` | `rxShutdown​(long timeout, TimeUnit unit)` | Initiate the client shutdown sequence.
    `Single<Boolean>` | `rxUpdateSSLOptions​(ClientSSLOptions options)` | Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Single<Boolean>` | `rxUpdateSSLOptions​(ClientSSLOptions options, boolean force)` | Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Completable` | `shutdown()` | Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
    `Completable` | `shutdown​(long timeout, TimeUnit unit)` | Initiate the client shutdown sequence.
    `String` | `toString()` |
    `Single<Boolean>` | `updateSSLOptions​(ClientSSLOptions options)` | Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Single<Boolean>` | `updateSSLOptions​(ClientSSLOptions options, boolean force)` | Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<HttpClientAgent> __TYPE_ARG

  - ### Constructor Detail

    - #### HttpClientAgent

          public HttpClientAgent​(HttpClientAgent delegate)

    - #### HttpClientAgent

          public HttpClientAgent​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public HttpClientAgent getDelegate()

      Specified by:
        `getDelegate` in interface `HttpClient`
      Specified by:
        `getDelegate` in interface `Measured`
      Specified by:
        `getDelegate` in interface `io.vertx.lang.rx.RxDelegate`

    - #### isMetricsEnabled

          public boolean isMetricsEnabled()

      Whether the metrics are enabled for this measured object
      Specified by:
        `isMetricsEnabled` in interface `Measured`
      Returns:
        `true` if metrics are enabled

    - #### request

          public Single<HttpClientRequest> request()

      Create an HTTP request to send to the server with the default host and port of the client.
      Specified by:
        `request` in interface `HttpClient`
      Returns:
        a future notified when the request is ready to be sent

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest()

      Create an HTTP request to send to the server with the default host and port of the client.
      Specified by:
        `rxRequest` in interface `HttpClient`
      Returns:
        a future notified when the request is ready to be sent

    - #### request

          public Single<HttpClientRequest> request​(RequestOptions options)

      Create an HTTP request to send to the server.
      Specified by:
        `request` in interface `HttpClient`
      Parameters:
        `options` - the request options
      Returns:
        a future notified when the request is ready to be sent

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest​(RequestOptions options)

      Create an HTTP request to send to the server.
      Specified by:
        `rxRequest` in interface `HttpClient`
      Parameters:
        `options` - the request options
      Returns:
        a future notified when the request is ready to be sent

    - #### request

          public Single<HttpClientRequest> request​(HttpMethod method,
                                                   int port,
                                                   String host,
                                                   String requestURI)

      Create an HTTP request to send to the server at the `host` and `port`.
      Specified by:
        `request` in interface `HttpClient`
      Parameters:
        `method` - the HTTP method
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
      Returns:
        a future notified when the request is ready to be sent

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest​(HttpMethod method,
                                                     int port,
                                                     String host,
                                                     String requestURI)

      Create an HTTP request to send to the server at the `host` and `port`.
      Specified by:
        `rxRequest` in interface `HttpClient`
      Parameters:
        `method` - the HTTP method
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
      Returns:
        a future notified when the request is ready to be sent

    - #### request

          public Single<HttpClientRequest> request​(HttpMethod method,
                                                   String host,
                                                   String requestURI)

      Create an HTTP request to send to the server at the `host` and default port.
      Specified by:
        `request` in interface `HttpClient`
      Parameters:
        `method` - the HTTP method
        `host` - the host
        `requestURI` - the relative URI
      Returns:
        a future notified when the request is ready to be sent

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest​(HttpMethod method,
                                                     String host,
                                                     String requestURI)

      Create an HTTP request to send to the server at the `host` and default port.
      Specified by:
        `rxRequest` in interface `HttpClient`
      Parameters:
        `method` - the HTTP method
        `host` - the host
        `requestURI` - the relative URI
      Returns:
        a future notified when the request is ready to be sent

    - #### request

          public Single<HttpClientRequest> request​(HttpMethod method,
                                                   String requestURI)

      Create an HTTP request to send to the server at the default host and port.
      Specified by:
        `request` in interface `HttpClient`
      Parameters:
        `method` - the HTTP method
        `requestURI` - the relative URI
      Returns:
        a future notified when the request is ready to be sent

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest​(HttpMethod method,
                                                     String requestURI)

      Create an HTTP request to send to the server at the default host and port.
      Specified by:
        `rxRequest` in interface `HttpClient`
      Parameters:
        `method` - the HTTP method
        `requestURI` - the relative URI
      Returns:
        a future notified when the request is ready to be sent

    - #### shutdown

          public Completable shutdown()

      Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
      Specified by:
        `shutdown` in interface `HttpClient`
      Returns:
        a future completed when shutdown has completed

    - #### rxShutdown

          public Completable rxShutdown()

      Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
      Specified by:
        `rxShutdown` in interface `HttpClient`
      Returns:
        a future completed when shutdown has completed

    - #### close

          public Completable close()

      Close immediately (`shutdown(0, TimeUnit.SECONDS`).
      Specified by:
        `close` in interface `HttpClient`
      Returns:
        a future notified when the client is closed

    - #### rxClose

          public Completable rxClose()

      Close immediately (`shutdown(0, TimeUnit.SECONDS`).
      Specified by:
        `rxClose` in interface `HttpClient`
      Returns:
        a future notified when the client is closed

    - #### shutdown

          public Completable shutdown​(long timeout,
                                      TimeUnit unit)

      Initiate the client shutdown sequence.

      Connections are taken out of service and closed when all inflight requests are processed, client connection are immediately removed from the pool. When all connections are closed the client is closed. When the `timeout` expires, all unclosed connections are immediately closed.

      - HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
      - HTTP/1.x client connection will be closed after the current response is received
      Specified by:
        `shutdown` in interface `HttpClient`
      Parameters:
        `timeout` - the amount of time after which all resources are forcibly closed
        `unit` - the of the timeout
      Returns:
        a future notified when the client is closed

    - #### rxShutdown

          public Completable rxShutdown​(long timeout,
                                        TimeUnit unit)

      Initiate the client shutdown sequence.

      Connections are taken out of service and closed when all inflight requests are processed, client connection are immediately removed from the pool. When all connections are closed the client is closed. When the `timeout` expires, all unclosed connections are immediately closed.

      - HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
      - HTTP/1.x client connection will be closed after the current response is received
      Specified by:
        `rxShutdown` in interface `HttpClient`
      Parameters:
        `timeout` - the amount of time after which all resources are forcibly closed
        `unit` - the of the timeout
      Returns:
        a future notified when the client is closed

    - #### updateSSLOptions

          public Single<Boolean> updateSSLOptions​(ClientSSLOptions options)

      Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
      Returns:
        a future signaling the update success

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions​(ClientSSLOptions options)

      Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
      Returns:
        a future signaling the update success

    - #### updateSSLOptions

          public Single<Boolean> updateSSLOptions​(ClientSSLOptions options,
                                                  boolean force)

      Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The `options` object is compared using its `equals` method against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, setting `force` to `true` forces the update.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:
        a future signaling the update success

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions​(ClientSSLOptions options,
                                                    boolean force)

      Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The `options` object is compared using its `equals` method against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, setting `force` to `true` forces the update.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:
        a future signaling the update success

    - #### connect

          public Single<HttpClientConnection> connect​(HttpConnectOptions options)

      Connect to a remote HTTP server with the specific `options`, the connection is un-pooled and the management of the connection is left to the user.
      Parameters:
        `options` - the server connect options
      Returns:
        a future notified when the connection is available

    - #### rxConnect

          public Single<HttpClientConnection> rxConnect​(HttpConnectOptions options)

      Connect to a remote HTTP server with the specific `options`, the connection is un-pooled and the management of the connection is left to the user.
      Parameters:
        `options` - the server connect options
      Returns:
        a future notified when the connection is available

    - #### newInstance

          public static HttpClientAgent newInstance​(HttpClientAgent arg)