Package io.vertx.ext.stomp
Interface StompServer
-
public interface StompServer
Defines a STOMP server. STOMP servers delegates to aStompServerHandler
that let customize the behavior of the server. By default, it uses a handler compliant with the STOMP specification, but let you change anything.- Author:
- Clement Escoffier
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description int
actualPort()
Gets the port on which the server is listening.Future<Void>
close()
Closes the server.static StompServer
create(Vertx vertx)
Creates aStompServer
based on the default Stomp Server implementation, and use the default options.static StompServer
create(Vertx vertx, NetServer netServer)
Creates aStompServer
based on the default Stomp Server implementation.static StompServer
create(Vertx vertx, NetServer net, StompServerOptions options)
Creates aStompServer
based on the default Stomp Server implementation.static StompServer
create(Vertx vertx, StompServerOptions options)
Creates aStompServer
based on the default Stomp Server implementation.StompServer
handler(StompServerHandler handler)
Configures theStompServerHandler
.boolean
isListening()
Checks whether or not the server is listening.Future<StompServer>
listen()
Connects the STOMP server default port (61613) and network interface (0.0.0.0
).Future<StompServer>
listen(int port)
Connects the STOMP server to the given port.Future<StompServer>
listen(int port, String host)
Connects the STOMP server to the given port / interface.StompServerOptions
options()
StompServerHandler
stompHandler()
Vertx
vertx()
Handler<ServerWebSocket>
webSocketHandler()
Gets theHandler
able to manage web socket connections.Handler<ServerWebSocketHandshake>
webSocketHandshakeHandler()
Gets theHandler
able to manage web socket connection handshakes.StompServer
writingFrameHandler(Handler<ServerFrame> handler)
Configures the handler that is invoked every time a frame is going to be written to the "wire".
-
-
-
Method Detail
-
create
static StompServer create(Vertx vertx, StompServerOptions options)
Creates aStompServer
based on the default Stomp Server implementation.- Parameters:
vertx
- the vert.x instance to useoptions
- the server options- Returns:
- the created
StompServer
-
create
static StompServer create(Vertx vertx, NetServer netServer)
Creates aStompServer
based on the default Stomp Server implementation.- Parameters:
vertx
- the vert.x instance to usenetServer
- the Net server used by the STOMP server- Returns:
- the created
StompServer
-
create
static StompServer create(Vertx vertx, NetServer net, StompServerOptions options)
Creates aStompServer
based on the default Stomp Server implementation.- Parameters:
vertx
- the vert.x instance to usenet
- the Net server used by the STOMP serveroptions
- the server options- Returns:
- the created
StompServer
-
create
static StompServer create(Vertx vertx)
Creates aStompServer
based on the default Stomp Server implementation, and use the default options.- Parameters:
vertx
- the vert.x instance to use- Returns:
- the created
StompServer
-
handler
StompServer handler(StompServerHandler handler)
Configures theStompServerHandler
. You must calls this method before calling thelisten()
method.- Parameters:
handler
- the handler- Returns:
- the current
StompServer
-
listen
Future<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:
- a future resolved with the listen result
-
listen
Future<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 porthost
- the interface- Returns:
- a future resolved with the listen result
-
listen
Future<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:
- a future resolved with the listen result
-
isListening
boolean isListening()
Checks whether or not the server is listening.- Returns:
true
if the server is listening,false
otherwise
-
actualPort
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
- See Also:
NetServer.actualPort()
-
options
StompServerOptions options()
- Returns:
- the server options
-
vertx
Vertx vertx()
- Returns:
- the instance of vert.x used by the server.
-
stompHandler
StompServerHandler stompHandler()
- Returns:
- the
StompServerHandler
used by this server.
-
webSocketHandshakeHandler
Handler<ServerWebSocketHandshake> webSocketHandshakeHandler()
Gets theHandler
able to manage web socket connection handshakes. If the web socket bridge is disabled, it returnsnull
.- Returns:
- the handler that can be passed to
HttpServer.webSocketHandshakeHandler(Handler)
.
-
webSocketHandler
Handler<ServerWebSocket> webSocketHandler()
Gets theHandler
able to manage web socket connections. If the web socket bridge is disabled, it returnsnull
.- Returns:
- the handler that can be passed to
HttpServer.webSocketHandler(Handler)
.
-
writingFrameHandler
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 benull
- Returns:
- the current
StompServer
-
-