Package: io.vertx.groovy.ext.stomp

## [Groovy] Class StompServer

- io.vertx.groovy.ext.stomp.StompServer

- Defines a STOMP server. STOMP servers delegates to a StompServerHandler that let customize the behavior of the server. By default, it uses a handler compliant with the STOMP specification, but let you change anything.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `StompServer (Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `int` | `actualPort()` Gets the port on which the server is listening.
    `void` | `close(Handler<AsyncResult<Void>> completionHandler)` Closes the server.
    `void` | `close()` Closes the server.
    `static StompServer` | `create(Vertx vertx, Map<String, Object> options)` Creates a StompServer based on the default Stomp Server implementation.
    `static StompServer` | `create(Vertx vertx, NetServer netServer)` Creates a StompServer based on the default Stomp Server implementation.
    `static StompServer` | `create(Vertx vertx, NetServer net, Map<String, Object> options)` Creates a StompServer based on the default Stomp Server implementation.
    `static StompServer` | `create(Vertx vertx)` Creates a StompServer based on the default Stomp Server implementation, and use the default options.
    `Object` | `getDelegate()`
    `StompServer` | `handler(StompServerHandler handler)` Configures the StompServerHandler.
    `boolean` | `isListening()` Checks whether or not the server is listening.
    `StompServer` | `listen(int port)` Connects the STOMP server to the given port.
    `StompServer` | `listen(int port, String host)` Connects the STOMP server to the given port / interface.
    `StompServer` | `listen()` Connects the STOMP server to the port / host configured in the server options.
    `StompServer` | `listen(Handler<AsyncResult<StompServer>> handler)` Connects the STOMP server default port (61613) and network interface (`0.0.0.0`).
    `StompServer` | `listen(int port, Handler<AsyncResult<StompServer>> handler)` Connects the STOMP server to the given port.
    `StompServer` | `listen(int port, String host, Handler<AsyncResult<StompServer>> handler)` Connects the STOMP server to the given port / interface.
    `Map<String, Object>` | `options()` @return the server options
    `StompServerHandler` | `stompHandler()` Returns: the StompServerHandler used by this server.
    `Vertx` | `vertx()` Returns: the instance of vert.x used by the server.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### StompServer(Object delegate)

  - ### Method Detail

    - #### int actualPort()

      Gets the port on which the server is listening.

      This is useful if you bound the server specifying 0 as port number signifying an ephemeral port.
      Returns:
        the port

    - #### void close(Handler<AsyncResult<Void>> completionHandler)

      Closes the server.

      Parameters:
        `completionHandler` - handler called once the server has been stopped

    - #### void close()

      Closes the server.

    - #### static StompServer create(Vertx vertx, Map<String, Object> options)

      Creates a StompServer based on the default Stomp Server implementation.

      Returns:
        the created StompServer
      Parameters:
        `vertx` - the vert.x instance to use
        `options` - the server options (see StompServerOptions)

    - #### static StompServer create(Vertx vertx, NetServer netServer)

      Creates a StompServer based on the default Stomp Server implementation.

      Returns:
        the created StompServer
      Parameters:
        `vertx` - the vert.x instance to use
        `netServer` - the Net server used by the STOMP server

    - #### static StompServer create(Vertx vertx, NetServer net, Map<String, Object> options)

      Creates a StompServer based on the default Stomp Server implementation.

      Returns:
        the created StompServer
      Parameters:
        `vertx` - the vert.x instance to use
        `net` - the Net server used by the STOMP server
        `options` - the server options (see StompServerOptions)

    - #### static StompServer create(Vertx vertx)

      Creates a StompServer based on the default Stomp Server implementation, and use the default options.

      Returns:
        the created StompServer
      Parameters:
        `vertx` - the vert.x instance to use

    - #### Object getDelegate()

    - #### StompServer handler(StompServerHandler handler)

      Configures the StompServerHandler. You must calls this method before calling the StompServer.listen method.

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

    - #### boolean isListening()

      Checks whether or not the server is listening.

      Returns:
        `true` if the server is listening, `false` otherwise

    - #### StompServer listen(int port)

      Connects the STOMP server to the given port.

      Returns:
        the current StompServer
      Parameters:
        `port` - the port

    - #### StompServer listen(int port, String host)

      Connects the STOMP server to the given port / interface.

      Returns:
        the current StompServer
      Parameters:
        `port` - the port
        `host` - the interface

    - #### StompServer listen()

      Connects the STOMP server to the port / host configured in the server options.

      Returns:
        the current StompServer

    - #### StompServer listen(Handler<AsyncResult<StompServer>> handler)

      Connects the STOMP server default port (61613) and network interface (`0.0.0.0`). Once the socket it bounds calls the given handler with the result. The result may be a failure if the socket is already used.

      Returns:
        the current StompServer
      Parameters:
        `handler` - the handler to call with the result

    - #### StompServer listen(int port, Handler<AsyncResult<StompServer>> handler)

      Connects the STOMP server to the given port. This method use the default host (`0.0.0.0`). Once the socket it bounds calls the given handler with the result. The result may be a failure if the socket is already used.

      Returns:
        the current StompServer
      Parameters:
        `port` - the port
        `handler` - the handler to call with the result

    - #### StompServer listen(int port, String host, Handler<AsyncResult<StompServer>> handler)

      Connects the STOMP server to the given port / interface. Once the socket it bounds calls the given handler with the result. The result may be a failure if the socket is already used.

      Returns:
        the current StompServer
      Parameters:
        `port` - the port
        `host` - the host / interface
        `handler` - the handler to call with the result

    - #### Map<String, Object> options()

      Returns:
        the server options
        (see StompServerOptions)

    - #### StompServerHandler stompHandler()

      Returns:
        the StompServerHandler used by this server.

    - #### Vertx vertx()

      Returns:
        the instance of vert.x used by the server.