Package: io.vertx.groovy.ext.stomp

## [Groovy] Class StompServerHandler

- io.vertx.groovy.ext.stomp.StompServerHandler

- All Implemented Interfaces and Traits:
    io.vertx.core.Handler

      @groovy.transform.CompileStatic
      class StompServerHandler

  STOMP server handler implements the behavior of the STOMP server when a specific event occurs. For instance, if let customize the behavior when specific STOMP frames arrives or when a connection is closed. This class has been designed to let you customize the server behavior. The default implementation is compliant with the STOMP specification. In this default implementation, not acknowledge frames are dropped.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `StompServerHandler (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `StompServerHandler` | `abortHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `ABORT` frame is received.
    `StompServerHandler` | `ackHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `ACK` frame is received.
    `StompServerHandler` | `authProvider(AuthProvider handler)` Configures the to be used to authenticate the user.
    `StompServerHandler` | `beginHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `BEGIN` frame is received.
    `StompServerHandler` | `bridge(java.util.Map<java.lang.String, java.lang.Object> options = [:])` Configures the STOMP server to act as a bridge with the Vert.x event bus.
    `StompServerHandler` | `closeHandler(io.vertx.core.Handler<StompServerConnection> handler)` Configures the action to execute when a connection with the client is closed.
    `StompServerHandler` | `commitHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `COMMIT` frame is received.
    `StompServerHandler` | `connectHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `CONNECT` frame is received.
    `static StompServerHandler` | `create(Vertx vertx)` Creates an instance of StompServerHandler using the default (compliant) implementation.
    `StompServerHandler` | `destinationFactory(DestinationFactory factory)` Configures the DestinationFactory used to create Destination objects.
    `StompServerHandler` | `disconnectHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `DISCONNECT` frame is received.
    `java.lang.Object` | `getDelegate()`
    `Destination` | `getDestination(java.lang.String destination)` Gets the destination with the given name.
    `java.util.List<Destination>` | `getDestinations()` Returns: the list of destination managed by the STOMP server.
    `Destination` | `getOrCreateDestination(java.lang.String destination)` Gets a Destination object if existing, or create a new one.
    `void` | `handle(ServerFrame arg0)`
    `StompServerHandler` | `nackHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `NACK` frame is received.
    `StompServerHandler` | `onAck(StompServerConnection connection, java.util.Map<java.lang.String, java.lang.Object> subscribe, java.util.List<java.util.Map<java.lang.String, java.lang.Object>> messages)` Method called by single message (client-individual policy) or a set of message (client policy) are acknowledged.
    `StompServerHandler` | `onAckHandler(io.vertx.core.Handler<Acknowledgement> handler)` Configures the action to execute when messages are acknowledged.
    `StompServerHandler` | `onAuthenticationRequest(StompServer server, java.lang.String login, java.lang.String passcode, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> handler)` Called when the client connects to a server requiring authentication.
    `void` | `onClose(StompServerConnection connection)` Called when the connection is closed.
    `StompServerHandler` | `onNack(StompServerConnection connection, java.util.Map<java.lang.String, java.lang.Object> subscribe, java.util.List<java.util.Map<java.lang.String, java.lang.Object>> messages)` Method called by single message (client-individual policy) or a set of message (client policy) are not acknowledged.
    `StompServerHandler` | `onNackHandler(io.vertx.core.Handler<Acknowledgement> handler)` Configures the action to execute when messages are not acknowledged.
    `StompServerHandler` | `pingHandler(io.vertx.core.Handler<StompServerConnection> handler)` Allows customizing the action to do when the server needs to send a `PING` to the client.
    `StompServerHandler` | `receivedFrameHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures a handler that get notified when a STOMP frame is received by the server.
    `StompServerHandler` | `sendHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `SEND` frame is received.
    `StompServerHandler` | `stompHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `STOMP` frame is received.
    `StompServerHandler` | `subscribeHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `SUBSCRIBE` frame is received.
    `StompServerHandler` | `unsubscribeHandler(io.vertx.core.Handler<ServerFrame> handler)` Configures the action to execute when a `UNSUBSCRIBE` frame is received.

  - ### 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

    - #### StompServerHandler(java.lang.Object delegate)

  - ### Method Detail

    - #### StompServerHandler abortHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `ABORT` frame is received.

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

    - #### StompServerHandler ackHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `ACK` frame is received.

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

    - #### StompServerHandler authProvider(AuthProvider handler)

      Configures the to be used to authenticate the user.

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

    - #### StompServerHandler beginHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `BEGIN` frame is received.

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

    - #### StompServerHandler bridge(java.util.Map<java.lang.String, java.lang.Object> options = [:])

      Configures the STOMP server to act as a bridge with the Vert.x event bus.

      Returns:
        the current StompServerHandler.
      Parameters:
        `options` - the configuration options (see BridgeOptions)

    - #### StompServerHandler closeHandler(io.vertx.core.Handler<StompServerConnection> handler)

      Configures the action to execute when a connection with the client is closed.

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

    - #### StompServerHandler commitHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `COMMIT` frame is received.

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

    - #### StompServerHandler connectHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `CONNECT` frame is received.

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

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

      Creates an instance of StompServerHandler using the default (compliant) implementation.

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

    - #### StompServerHandler destinationFactory(DestinationFactory factory)

      Configures the DestinationFactory used to create Destination objects.

      Returns:
        the current StompServerHandler.
      Parameters:
        `factory` - the factory

    - #### StompServerHandler disconnectHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `DISCONNECT` frame is received.

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

    - #### java.lang.Object getDelegate()

    - #### Destination getDestination(java.lang.String destination)

      Gets the destination with the given name.

      Returns:
        the Destination, `null` if not existing.
      Parameters:
        `destination` - the destination

    - #### java.util.List<Destination> getDestinations()

      Returns:
        the list of destination managed by the STOMP server. Don't forget the STOMP interprets destination as opaque Strings.

    - #### Destination getOrCreateDestination(java.lang.String destination)

      Gets a Destination object if existing, or create a new one. The creation is delegated to the DestinationFactory.

      Returns:
        the Destination instance, may have been created.
      Parameters:
        `destination` - the destination

    - #### void handle(ServerFrame arg0)

    - #### StompServerHandler nackHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `NACK` frame is received.

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

    - #### StompServerHandler onAck(StompServerConnection connection, java.util.Map<java.lang.String, java.lang.Object> subscribe, java.util.List<java.util.Map<java.lang.String, java.lang.Object>> messages)

      Method called by single message (client-individual policy) or a set of message (client policy) are acknowledged. Implementations must call the handler configured using StompServerHandler.onAckHandler.

      Returns:
        the current StompServerHandler
      Parameters:
        `connection` - the connection
        `subscribe` - the `SUBSCRIBE` frame (see Frame)
        `messages` - the acknowledge messages

    - #### StompServerHandler onAckHandler(io.vertx.core.Handler<Acknowledgement> handler)

      Configures the action to execute when messages are acknowledged.

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

    - #### StompServerHandler onAuthenticationRequest(StompServer server, java.lang.String login, java.lang.String passcode, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> handler)

      Called when the client connects to a server requiring authentication. It invokes the configured using StompServerHandler.authProvider.

      Returns:
        the current StompServerHandler
      Parameters:
        `server` - the STOMP server.
        `login` - the login
        `passcode` - the password
        `handler` - handler receiving the authentication result

    - #### void onClose(StompServerConnection connection)

      Called when the connection is closed. This method executes a default behavior and must calls the configured StompServerHandler.closeHandler if any.

      Parameters:
        `connection` - the connection

    - #### StompServerHandler onNack(StompServerConnection connection, java.util.Map<java.lang.String, java.lang.Object> subscribe, java.util.List<java.util.Map<java.lang.String, java.lang.Object>> messages)

      Method called by single message (client-individual policy) or a set of message (client policy) are not acknowledged. Not acknowledgment can result from a `NACK` frame or from a timeout (no `ACK` frame received in a given time. Implementations must call the handler configured using StompServerHandler.onNackHandler.

      Returns:
        the current StompServerHandler
      Parameters:
        `connection` - the connection
        `subscribe` - the `SUBSCRIBE` frame (see Frame)
        `messages` - the acknowledge messages

    - #### StompServerHandler onNackHandler(io.vertx.core.Handler<Acknowledgement> handler)

      Configures the action to execute when messages are not acknowledged.

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

    - #### StompServerHandler pingHandler(io.vertx.core.Handler<StompServerConnection> handler)

      Allows customizing the action to do when the server needs to send a `PING` to the client. By default it send a frame containing `EOL` (specification). However, you can customize this and send another frame. However, be aware that this may requires a custom client.

      The handler will only be called if the connection supports heartbeats.
      Returns:
        the current StompServerHandler
      Parameters:
        `handler` - the action to execute when a `PING` needs to be sent.

    - #### StompServerHandler receivedFrameHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures a handler that get notified when a STOMP frame is received by the server. This handler can be used for logging, debugging or ad-hoc behavior.

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

    - #### StompServerHandler sendHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `SEND` frame is received.

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

    - #### StompServerHandler stompHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `STOMP` frame is received.

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

    - #### StompServerHandler subscribeHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `SUBSCRIBE` frame is received.

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

    - #### StompServerHandler unsubscribeHandler(io.vertx.core.Handler<ServerFrame> handler)

      Configures the action to execute when a `UNSUBSCRIBE` frame is received.

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