Class StompServer


  • public class StompServer
    extends Object
    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.

    NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.

    • Constructor Detail

      • StompServer

        public StompServer​(StompServer delegate)
      • StompServer

        public StompServer​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static StompServer create​(Vertx vertx,
                                         NetServer netServer)
        Creates a StompServer based on the default Stomp Server implementation.
        Parameters:
        vertx - the vert.x instance to use
        netServer - the Net server used by the STOMP server
        Returns:
        the created StompServer
      • create

        public static StompServer create​(Vertx vertx,
                                         NetServer net,
                                         StompServerOptions options)
        Creates a StompServer based on the default Stomp Server implementation.
        Parameters:
        vertx - the vert.x instance to use
        net - the Net server used by the STOMP server
        options - the server options
        Returns:
        the created StompServer
      • create

        public static StompServer create​(Vertx vertx)
        Creates a StompServer based on the default Stomp Server implementation, and use the default options.
        Parameters:
        vertx - the vert.x instance to use
        Returns:
        the created StompServer
      • listen

        public 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.
        Parameters:
        handler - the handler to call with the result
        Returns:
        the current StompServer
      • listen

        public StompServer listen()
        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
      • rxListen

        public io.reactivex.Single<StompServer> rxListen()
        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
      • listen

        public 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.
        Parameters:
        port - the port
        handler - the handler to call with the result
        Returns:
        the current StompServer
      • listen

        public StompServer listen​(int port)
        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.
        Parameters:
        port - the port
        Returns:
        the current StompServer
      • rxListen

        public io.reactivex.Single<StompServer> rxListen​(int port)
        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.
        Parameters:
        port - the port
        Returns:
        the current StompServer
      • listen

        public 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.
        Parameters:
        port - the port
        host - the host / interface
        handler - the handler to call with the result
        Returns:
        the current StompServer
      • listen

        public StompServer listen​(int port,
                                  String host)
        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.
        Parameters:
        port - the port
        host - the host / interface
        Returns:
        the current StompServer
      • rxListen

        public io.reactivex.Single<StompServer> rxListen​(int port,
                                                         String host)
        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.
        Parameters:
        port - the port
        host - the host / interface
        Returns:
        the current StompServer
      • close

        public void close​(Handler<AsyncResult<Void>> completionHandler)
        Closes the server.
        Parameters:
        completionHandler - handler called once the server has been stopped
      • close

        public void close()
        Closes the server.
      • rxClose

        public io.reactivex.Completable rxClose()
        Closes the server.
        Returns:
      • isListening

        public boolean isListening()
        Checks whether or not the server is listening.
        Returns:
        true if the server is listening, false otherwise
      • actualPort

        public 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
      • vertx

        public Vertx vertx()
        Returns:
        the instance of vert.x used by the server.
      • writingFrameHandler

        public StompServer writingFrameHandler​(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.
        Parameters:
        handler - the handler, must not be null
        Returns:
        the current StompServer