Package io.vertx.mutiny.ext.stomp
Class StompServerHandler
- java.lang.Object
-
- io.vertx.mutiny.ext.stomp.StompServerHandler
-
- All Implemented Interfaces:
io.vertx.core.Handler<ServerFrame>
,Consumer<ServerFrame>
public class StompServerHandler extends Object implements io.vertx.core.Handler<ServerFrame>, Consumer<ServerFrame>
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. NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<StompServerHandler>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description StompServerHandler(io.vertx.ext.stomp.StompServerHandler delegate)
StompServerHandler(Object delegate)
-
Method Summary
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<StompServerHandler> __TYPE_ARG
-
-
Constructor Detail
-
StompServerHandler
public StompServerHandler(io.vertx.ext.stomp.StompServerHandler delegate)
-
StompServerHandler
public StompServerHandler(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.stomp.StompServerHandler getDelegate()
-
handle
public void handle(ServerFrame arg0)
- Specified by:
handle
in interfaceio.vertx.core.Handler<ServerFrame>
-
create
public static StompServerHandler create(Vertx vertx)
- Parameters:
vertx
- the vert.x instance to use- Returns:
- the created
StompServerHandler
-
receivedFrameHandler
public StompServerHandler receivedFrameHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
connectHandler
public StompServerHandler connectHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
stompHandler
public StompServerHandler stompHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
subscribeHandler
public StompServerHandler subscribeHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
unsubscribeHandler
public StompServerHandler unsubscribeHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
sendHandler
public StompServerHandler sendHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
closeHandler
public StompServerHandler closeHandler(Consumer<StompServerConnection> handler)
- Parameters:
handler
- the handler- Returns:
-
onClose
public void onClose(StompServerConnection connection)
- Parameters:
connection
- the connection
-
commitHandler
public StompServerHandler commitHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
abortHandler
public StompServerHandler abortHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
beginHandler
public StompServerHandler beginHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
disconnectHandler
public StompServerHandler disconnectHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
ackHandler
public StompServerHandler ackHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
nackHandler
public StompServerHandler nackHandler(Consumer<ServerFrame> handler)
- Parameters:
handler
- the handler- Returns:
-
onAuthenticationRequest
public io.smallrye.mutiny.Uni<Boolean> onAuthenticationRequest(StompServerConnection connection, String login, String passcode)
Called when the client connects to a server requiring authentication. It invokes the configured usingauthProvider(io.vertx.mutiny.ext.auth.authentication.AuthenticationProvider)
.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
connection
- server connection that contains session IDlogin
- the loginpasscode
- the password- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
onAuthenticationRequestAndAwait
public Boolean onAuthenticationRequestAndAwait(StompServerConnection connection, String login, String passcode)
Blocking variant ofonAuthenticationRequest(io.vertx.mutiny.ext.stomp.StompServerConnection,String,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
connection
- server connection that contains session IDlogin
- the loginpasscode
- the password- Returns:
- the Boolean instance produced by the operation.
-
onAuthenticationRequestAndForget
public StompServerHandler onAuthenticationRequestAndForget(StompServerConnection connection, String login, String passcode)
Variant ofonAuthenticationRequest(io.vertx.mutiny.ext.stomp.StompServerConnection,String,String)
that ignores the result of the operation.This method subscribes on the result of
onAuthenticationRequest(io.vertx.mutiny.ext.stomp.StompServerConnection,String,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromonAuthenticationRequest(io.vertx.mutiny.ext.stomp.StompServerConnection,String,String)
but you don't need to compose it with other operations.- Parameters:
connection
- server connection that contains session IDlogin
- the loginpasscode
- the password- Returns:
- the instance of StompServerHandler to chain method calls.
-
getUserBySession
public User getUserBySession(String session)
- Parameters:
session
- session ID for the server connection.- Returns:
- null if not authenticated.
-
authProvider
public StompServerHandler authProvider(AuthenticationProvider handler)
- Parameters:
handler
- the handler- Returns:
- the current
StompServerHandler
-
getDestinations
public List<Destination> getDestinations()
- Returns:
- the list of destination managed by the STOMP server. Don't forget the STOMP interprets destination as opaque Strings.
-
getDestination
public Destination getDestination(String destination)
- Parameters:
destination
- the destination- Returns:
- the
Destination
,null
if not existing.
-
onAck
public StompServerHandler onAck(StompServerConnection connection, io.vertx.ext.stomp.Frame subscribe, List<io.vertx.ext.stomp.Frame> messages)
- Parameters:
connection
- the connectionsubscribe
- theSUBSCRIBE
framemessages
- the acknowledge messages- Returns:
- the current
StompServerHandler
-
onNack
public StompServerHandler onNack(StompServerConnection connection, io.vertx.ext.stomp.Frame subscribe, List<io.vertx.ext.stomp.Frame> messages)
- Parameters:
connection
- the connectionsubscribe
- theSUBSCRIBE
framemessages
- the acknowledge messages- Returns:
- the current
StompServerHandler
-
onAckHandler
public StompServerHandler onAckHandler(Consumer<Acknowledgement> handler)
- Parameters:
handler
- the handler- Returns:
-
onNackHandler
public StompServerHandler onNackHandler(Consumer<Acknowledgement> handler)
- Parameters:
handler
- the handler- Returns:
-
pingHandler
public StompServerHandler pingHandler(Consumer<StompServerConnection> handler)
- Parameters:
handler
- the action to execute when a `PING` needs to be sent.- Returns:
-
getOrCreateDestination
public Destination getOrCreateDestination(String destination)
- Parameters:
destination
- the destination- Returns:
- the
Destination
instance, may have been created.
-
destinationFactory
public StompServerHandler destinationFactory(DestinationFactory factory)
- Parameters:
factory
- the factory- Returns:
- the current
StompServerHandler
.
-
bridge
public StompServerHandler bridge(io.vertx.ext.stomp.BridgeOptions options)
- Parameters:
options
- the configuration options- Returns:
- the current
StompServerHandler
.
-
accept
public void accept(ServerFrame item)
- Specified by:
accept
in interfaceConsumer<ServerFrame>
-
newInstance
public static StompServerHandler newInstance(io.vertx.ext.stomp.StompServerHandler arg)
-
-