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 (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `int` | `actualPort()` Gets the port on which the server is listening.
    `void` | `close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)` Closes the server.
    `void` | `close()` Closes the server.
    `static StompServer` | `create(Vertx vertx, java.util.Map<java.lang.String, java.lang.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, java.util.Map<java.lang.String, java.lang.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.
    `java.lang.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, java.lang.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(io.vertx.core.Handler<io.vertx.core.AsyncResult<StompServer>> handler)` Connects the STOMP server default port (61613) and network interface (`0.0.0.0`).
    `StompServer` | `listen(int port, io.vertx.core.Handler<io.vertx.core.AsyncResult<StompServer>> handler)` Connects the STOMP server to the given port.
    `StompServer` | `listen(int port, java.lang.String host, io.vertx.core.Handler<io.vertx.core.AsyncResult<StompServer>> handler)` Connects the STOMP server to the given port / interface.
    `java.util.Map<java.lang.String, java.lang.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.
    `io.vertx.core.Handler<ServerWebSocket>` | `webSocketHandler()` Gets the able to manage web socket connections.
    `StompServer` | `writingFrameHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the handler that is invoked every time a frame is going to be written to the "wire".

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### StompServer(java.lang.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(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.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, java.util.Map<java.lang.String, java.lang.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, java.util.Map<java.lang.String, java.lang.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

    - #### java.lang.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, java.lang.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(io.vertx.core.Handler<io.vertx.core.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, io.vertx.core.Handler<io.vertx.core.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, java.lang.String host, io.vertx.core.Handler<io.vertx.core.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

    - #### java.util.Map<java.lang.String, java.lang.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.

    - #### io.vertx.core.Handler<ServerWebSocket> webSocketHandler()

      Gets the able to manage web socket connections. If the web socket bridge is disabled, it returns `null`.

      Returns:
        the handler that can be passed to HttpServer.websocketHandler.

    - #### StompServer writingFrameHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the handler that is invoked every time a frame is going to be written to the "wire". It lets you log the frames, but also adapt the frame if needed.

      Returns:
        the current StompServer
      Parameters:
        `handler` - the handler, must not be `null`