io.vertx.ext.stomp

## Interface StompClient

-     public interface StompClient

  Defines a STOMP client.
  Author:
    Clement Escoffier

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the client.
    `Future<StompClientConnection>` | `connect()` Like `connect(Handler)` but returns a `Future` of the asynchronous result
    `StompClient` | `connect(Handler<AsyncResult<StompClientConnection>> resultHandler)` Connects to the server using the host and port configured in the client's options.
    `Future<StompClientConnection>` | `connect(int port, String host)` Like `connect(int, String, Handler)` but returns a `Future` of the asynchronous result
    `StompClient` | `connect(int port, String host, Handler<AsyncResult<StompClientConnection>> resultHandler)` Connects to the server.
    `Future<StompClientConnection>` | `connect(int port, String host, NetClient net)` Like `connect(int, String, NetClient, Handler)` but returns a `Future` of the asynchronous result
    `StompClient` | `connect(int port, String host, NetClient net, Handler<AsyncResult<StompClientConnection>> resultHandler)` Connects to the server.
    `Future<StompClientConnection>` | `connect(NetClient net)` Like `connect(NetClient, Handler)` but returns a `Future` of the asynchronous result
    `StompClient` | `connect(NetClient net, Handler<AsyncResult<StompClientConnection>> resultHandler)` Connects to the server.
    `static StompClient` | `create(Vertx vertx)` Creates a `StompClient` using the default implementation.
    `static StompClient` | `create(Vertx vertx, StompClientOptions options)` Creates a `StompClient` using the default implementation.
    `StompClient` | `errorFrameHandler(Handler<Frame> handler)` A general error frame handler.
    `StompClient` | `exceptionHandler(Handler<Throwable> handler)` Sets an exception handler notified for TCP-level errors.
    `boolean` | `isClosed()`
    `StompClientOptions` | `options()`
    `StompClient` | `receivedFrameHandler(Handler<Frame> handler)` Configures a received handler that gets notified when a STOMP frame is received by the client.
    `Vertx` | `vertx()`
    `StompClient` | `writingFrameHandler(Handler<Frame> handler)` Configures a writing handler that gets notified when a STOMP frame is written on the wire.

- - ### Method Detail

    - #### create

          static StompClient create(Vertx vertx)

      Creates a `StompClient` using the default implementation.
      Parameters:
        `vertx` - the vert.x instance to use
      Returns:
        the created `StompClient`

    - #### create

          static StompClient create(Vertx vertx,
                                    StompClientOptions options)

      Creates a `StompClient` using the default implementation.
      Parameters:
        `vertx` - the vert.x instance to use
        `options` - the options
      Returns:
        the created `StompClient`

    - #### connect

          StompClient connect(int port,
                              String host,
                              Handler<AsyncResult<StompClientConnection>> resultHandler)

      Connects to the server.
      Parameters:
        `port` - the server port
        `host` - the server host
        `resultHandler` - handler called with the connection result
      Returns:
        the current `StompClient`

    - #### connect

          Future<StompClientConnection> connect(int port,
                                                String host)

      Like `connect(int, String, Handler)` but returns a `Future` of the asynchronous result

    - #### connect

          StompClient connect(NetClient net,
                              Handler<AsyncResult<StompClientConnection>> resultHandler)

      Connects to the server.
      Parameters:
        `net` - the NET client to use
        `resultHandler` - handler called with the connection result
      Returns:
        the current `StompClient`

    - #### connect

          Future<StompClientConnection> connect(NetClient net)

      Like `connect(NetClient, Handler)` but returns a `Future` of the asynchronous result

    - #### connect

          StompClient connect(int port,
                              String host,
                              NetClient net,
                              Handler<AsyncResult<StompClientConnection>> resultHandler)

      Connects to the server.
      Parameters:
        `port` - the server port
        `host` - the server host
        `net` - the NET client to use
        `resultHandler` - handler called with the connection result
      Returns:
        the current `StompClient`

    - #### connect

          Future<StompClientConnection> connect(int port,
                                                String host,
                                                NetClient net)

      Like `connect(int, String, NetClient, Handler)` but returns a `Future` of the asynchronous result

    - #### connect

          StompClient connect(Handler<AsyncResult<StompClientConnection>> resultHandler)

      Connects to the server using the host and port configured in the client's options.
      Parameters:
        `resultHandler` - handler called with the connection result. A failure will be sent to the handler if a TCP level issue happen before the `CONNECTED` frame is received. Afterwards, the `exceptionHandler(Handler)` is called.
      Returns:
        the current `StompClient`

    - #### connect

          Future<StompClientConnection> connect()

      Like `connect(Handler)` but returns a `Future` of the asynchronous result

    - #### receivedFrameHandler

          StompClient receivedFrameHandler(Handler<Frame> handler)

      Configures a received handler that gets notified when a STOMP frame is received by the client. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.

      When a connection is created, the handler is used as `StompClientConnection.receivedFrameHandler(Handler)`.

      Parameters:
        `handler` - the handler
      Returns:
        the current `StompClient`

    - #### writingFrameHandler

          StompClient writingFrameHandler(Handler<Frame> handler)

      Configures a writing handler that gets notified when a STOMP frame is written on the wire. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.

      When a connection is created, the handler is used as `StompClientConnection.writingFrameHandler(Handler)`.

      Parameters:
        `handler` - the handler
      Returns:
        the current `StompClient`

    - #### errorFrameHandler

          StompClient errorFrameHandler(Handler<Frame> handler)

      A general error frame handler. It can be used to catch `ERROR` frame emitted during the connection process (wrong authentication). This error handler will be pass to all `StompClientConnection` created from this client. Obviously, the client can override it when the connection is established.
      Parameters:
        `handler` - the handler
      Returns:
        the current `StompClient`

    - #### exceptionHandler

          StompClient exceptionHandler(Handler<Throwable> handler)

      Sets an exception handler notified for TCP-level errors.
      Parameters:
        `handler` - the handler
      Returns:
        the current `StompClient`

    - #### close

          void close()

      Closes the client.

    - #### options

          StompClientOptions options()

      Returns:
        the client's options.

    - #### vertx

          Vertx vertx()

      Returns:
        the vert.x instance used by the client.

    - #### isClosed

          boolean isClosed()

      Returns:
        whether or not the client is connected to the server.

Copyright © 2021 Eclipse. All rights reserved.