Package: io.vertx.groovy.ext.stomp

## [Groovy] Class StompServerHandler

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

- All Implemented Interfaces and Traits:
    Handler

      @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 (Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `StompServerHandler` | `abortHandler(Handler<ServerFrame> handler)` Configures the action to execute when a `ABORT` frame is received.
    `StompServerHandler` | `ackHandler(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(Handler<ServerFrame> handler)` Configures the action to execute when a `BEGIN` frame is received.
    `StompServerHandler` | `bridge(Map<String, Object> options = [:])` Configures the STOMP server to act as a bridge with the Vert.x event bus.
    `StompServerHandler` | `closeHandler(Handler<StompServerConnection> handler)` Configures the action to execute when a connection with the client is closed.
    `StompServerHandler` | `commitHandler(Handler<ServerFrame> handler)` Configures the action to execute when a `COMMIT` frame is received.
    `StompServerHandler` | `connectHandler(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(Handler<ServerFrame> handler)` Configures the action to execute when a `DISCONNECT` frame is received.
    `Object` | `getDelegate()`
    `Destination` | `getDestination(String destination)` Gets the destination with the given name.
    `List<Destination>` | `getDestinations()` Returns: the list of destination managed by the STOMP server.
    `Destination` | `getOrCreateDestination(String destination)` Gets a Destination object if existing, or create a new one.
    `void` | `handle(ServerFrame arg0)`
    `StompServerHandler` | `nackHandler(Handler<ServerFrame> handler)` Configures the action to execute when a `NACK` frame is received.
    `StompServerHandler` | `onAck(StompServerConnection connection, Map<String, Object> subscribe, List<Map<String, Object>> messages)` Method called by single message (client-individual policy) or a set of message (client policy) are acknowledged.
    `StompServerHandler` | `onAckHandler(Handler<Acknowledgement> handler)` Configures the action to execute when messages are acknowledged.
    `StompServerHandler` | `onAuthenticationRequest(StompServer server, String login, String passcode, Handler<AsyncResult<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, Map<String, Object> subscribe, List<Map<String, Object>> messages)` Method called by single message (client-individual policy) or a set of message (client policy) are not acknowledged.
    `StompServerHandler` | `onNackHandler(Handler<Acknowledgement> handler)` Configures the action to execute when messages are not acknowledged.
    `StompServerHandler` | `pingHandler(Handler<StompServerConnection> handler)` Allows customizing the action to do when the server needs to send a `PING` to the client.
    `StompServerHandler` | `sendHandler(Handler<ServerFrame> handler)` Configures the action to execute when a `SEND` frame is received.
    `StompServerHandler` | `stompHandler(Handler<ServerFrame> handler)` Configures the action to execute when a `STOMP` frame is received.
    `StompServerHandler` | `subscribeHandler(Handler<ServerFrame> handler)` Configures the action to execute when a `SUBSCRIBE` frame is received.
    `StompServerHandler` | `unsubscribeHandler(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 Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### StompServerHandler(Object delegate)

  - ### Method Detail

    - #### StompServerHandler abortHandler(Handler<ServerFrame> handler)

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

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

    - #### StompServerHandler ackHandler(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(Handler<ServerFrame> handler)

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

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

    - #### StompServerHandler bridge(Map<String, 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(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(Handler<ServerFrame> handler)

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

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

    - #### StompServerHandler connectHandler(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(Handler<ServerFrame> handler)

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

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

    - #### Object getDelegate()

    - #### Destination getDestination(String destination)

      Gets the destination with the given name.

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

    - #### 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(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(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, Map<String, Object> subscribe, List<Map<String, 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(Handler<Acknowledgement> handler)

      Configures the action to execute when messages are acknowledged.

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

    - #### StompServerHandler onAuthenticationRequest(StompServer server, String login, String passcode, Handler<AsyncResult<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, Map<String, Object> subscribe, List<Map<String, 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(Handler<Acknowledgement> handler)

      Configures the action to execute when messages are not acknowledged.

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

    - #### StompServerHandler pingHandler(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 sendHandler(Handler<ServerFrame> handler)

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

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

    - #### StompServerHandler stompHandler(Handler<ServerFrame> handler)

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

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

    - #### StompServerHandler subscribeHandler(Handler<ServerFrame> handler)

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

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

    - #### StompServerHandler unsubscribeHandler(Handler<ServerFrame> handler)

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

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