Class StompServerOptions
java.lang.Object
io.vertx.core.net.NetworkOptions
io.vertx.core.net.TCPSSLOptions
io.vertx.core.net.NetServerOptions
io.vertx.ext.stomp.StompServerOptions
- All Implemented Interfaces:
StompOptions
STOMP Server options. You can also configure the Net Server used by the STOMP server from these options.
- Author:
- Clement Escoffier
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringFields inherited from class NetServerOptions
DEFAULT_ACCEPT_BACKLOG, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_PROXY_PROTOCOL_TIMEOUT, DEFAULT_PROXY_PROTOCOL_TIMEOUT_TIME_UNIT, DEFAULT_REGISTER_WRITE_HANDLER, DEFAULT_USE_PROXY_PROTOCOLFields inherited from class TCPSSLOptions
DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEAPLIVE_COUNT, DEFAULT_TCP_KEEAPLIVE_IDLE_SECONDS, DEFAULT_TCP_KEEAPLIVE_INTERVAL_SECONDS, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUTFields inherited from class NetworkOptions
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASSFields inherited from interface StompOptions
DEFAULT_STOMP_HEARTBEAT, DEFAULT_STOMP_HOST, DEFAULT_STOMP_PORT, DEFAULT_SUPPORTED_VERSIONS, DEFAULT_TRAILING_LINE, UTF_8 -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.StompServerOptions(JsonObject json) Create an instance from aJsonObject.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionGets the heartbeat configuration.intGets the max length of the frame body accepted by the server.intGets the maximum number of frames that can be added to a transaction.intGets the max length of header's value.intGets the maximum number of headers supported by the server.intGets the maximum of subscriptions a client is allowed to register.intgetPort()Gets the STOMP protocol versions supported by the server.intGets the time factor, i.e. a multiplier applied to time constraints as a window error. 1 by default.intGets the chunk size when replaying a transaction.Gets the WebSocket frame type to use when sending STOMP messages over WebSocket.Gets the path for the web socket.booleanChecks whether or not the server is secured (meaning it has an authentication mechanism).booleanChecks whether or not an error is sent to the client when this client sends a message to an not subscribed destinations (no subscriptions on this destination).booleanGets whether or not an empty line should be appended to the written STOMP frame.booleanChecks whether or not the web socket bridge is enabled.setHeartbeat(JsonObject heartbeat) Sets the heartbeat configuration.Set the hostsetMaxBodyLength(int maxBodyLength) Sets the max body length accepted by the server. 10 Mb by default.setMaxFrameInTransaction(int maxFrameInTransaction) Sets the maximum number of frame that can be added in a transaction.setMaxHeaderLength(int maxHeaderLength) Sets the max header length.setMaxHeaders(int maxHeaders) Sets the maximum number of headers. 1000 by default.setMaxSubscriptionsByClient(int maxSubscriptionsByClient) Sets the maximum of subscriptions a client is allowed to register.setPort(int port) Sets the port on which the server is going to listen for TCP connection.setSecured(boolean secured) Enables or disables the server security feature.setSendErrorOnNoSubscriptions(boolean sendErrorOnNoSubscriptions) Sets whether or not an error is sent to the client when this client sends a message to an not subscribed destinations (no subscriptions on this destination).setSsl(boolean ssl) Set whether SSL/TLS is enabledsetSupportedVersions(List<String> supportedVersions) Sets the STOMP protocol versions supported by the server.setTimeFactor(int timeFactor) Sets the time factor.setTrailingLine(boolean trailingLine) Sets whether or not an empty line should be appended to the written STOMP frame.setTransactionChunkSize(int transactionChunkSize) Sets the chunk size when replaying a transaction.setWebsocketBridge(boolean websocketBridge) Enables or disables the web socket bridge.setWebSocketFrameType(WebSocketFrameType webSocketFrameType) Sets the WebSocket frame type to use when sending STOMP messages over WebSocket.setWebsocketPath(String websocketPath) Sets the websocket path.toJson()Convert to JSONMethods inherited from class NetServerOptions
addCrlPath, addCrlValue, addEnabledCipherSuite, addEnabledSecureTransportProtocol, copy, createSSLOptions, getAcceptBacklog, getClientAuth, getHost, getOrCreateSSLOptions, getProxyProtocolTimeout, getProxyProtocolTimeoutUnit, getSslOptions, getTrafficShapingOptions, isFileRegionEnabled, isRegisterWriteHandler, isSni, isUseProxyProtocol, removeEnabledCipherSuite, removeEnabledSecureTransportProtocol, setAcceptBacklog, setActivityLogDataFormat, setClientAuth, setEnabledSecureTransportProtocols, setIdleTimeout, setIdleTimeoutUnit, setKeyCertOptions, setLogActivity, setProxyProtocolTimeout, setProxyProtocolTimeoutUnit, setReadIdleTimeout, setReceiveBufferSize, setRegisterWriteHandler, setReuseAddress, setReusePort, setSendBufferSize, setSni, setSoLinger, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTcpUserTimeout, setTrafficClass, setTrafficShapingOptions, setTrustOptions, setUseAlpn, setUseProxyProtocol, setWriteIdleTimeoutMethods inherited from class TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getReceiveBufferSize, getSendBufferSize, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpKeepAliveCount, getTcpKeepAliveIdleSeconds, getTcpKeepAliveIntervalSeconds, getTcpUserTimeout, getTrafficClass, getTransportOptions, getTrustOptions, getWriteIdleTimeout, isReuseAddress, isReusePort, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setTcpKeepAliveCount, setTcpKeepAliveIdleSeconds, setTcpKeepAliveIntervalSecondsMethods inherited from class NetworkOptions
getActivityLogDataFormat, getLogActivity
-
Field Details
-
DEFAULT_MAX_HEADER_LENGTH
public static final int DEFAULT_MAX_HEADER_LENGTH- See Also:
-
DEFAULT_MAX_HEADERS
public static final int DEFAULT_MAX_HEADERS- See Also:
-
DEFAULT_MAX_BODY_LENGTH
public static final int DEFAULT_MAX_BODY_LENGTH- See Also:
-
DEFAULT_MAX_FRAME_IN_TRANSACTION
public static final int DEFAULT_MAX_FRAME_IN_TRANSACTION- See Also:
-
DEFAULT_TRANSACTION_CHUNK_SIZE
public static final int DEFAULT_TRANSACTION_CHUNK_SIZE- See Also:
-
DEFAULT_MAX_SUBSCRIPTIONS_BY_CLIENT
public static final int DEFAULT_MAX_SUBSCRIPTIONS_BY_CLIENT- See Also:
-
DEFAULT_WEBSOCKET_PATH
- See Also:
-
-
Constructor Details
-
StompServerOptions
public StompServerOptions()Default constructor. -
StompServerOptions
Copy constructor.- Parameters:
other- The otherStompServerOptionsto copy when creating this
-
StompServerOptions
Create an instance from aJsonObject.- Parameters:
json- the JsonObject to create it from
-
-
Method Details
-
toJson
Description copied from class:NetServerOptionsConvert to JSON- Overrides:
toJsonin classNetServerOptions- Returns:
- the JSON representation of this object.
-
getMaxBodyLength
public int getMaxBodyLength()Gets the max length of the frame body accepted by the server. If a frame exceeds this size, the frame is rejected and an error is sent to the client.- Returns:
- the max body length in bytes
-
setMaxBodyLength
Sets the max body length accepted by the server. 10 Mb by default.- Parameters:
maxBodyLength- the length in bytes.- Returns:
- the current
StompServerOptions
-
getMaxHeaderLength
public int getMaxHeaderLength()Gets the max length of header's value. If a frame has an header with a value exceeding this length, the frame is rejected and an error is sent to the client. 10240 by default.- Returns:
- the max header length
-
setMaxHeaderLength
Sets the max header length.- Parameters:
maxHeaderLength- the max length of headers- Returns:
- the current
StompServerOptions
-
getMaxHeaders
public int getMaxHeaders()Gets the maximum number of headers supported by the server. If a frame exceeds the number of headers, the frame is rejected and an error is sent to the client.- Returns:
- the max number of headers
-
setMaxHeaders
Sets the maximum number of headers. 1000 by default.- Parameters:
maxHeaders- the number of headers- Returns:
- the current
StompServerOptions
-
getSupportedVersions
-
setSupportedVersions
Sets the STOMP protocol versions supported by the server. Versions must be given in the decreasing order.- Parameters:
supportedVersions- the set of supported versions.- Returns:
- the current
StompServerOptions
-
isSecured
public boolean isSecured()Checks whether or not the server is secured (meaning it has an authentication mechanism). Security is disabled by default and requires anAuthenticationProviderhandler.- Returns:
- whether or not the option is enabled.
-
setSecured
Enables or disables the server security feature. It requires anAuthenticationProviderhandler.- Parameters:
secured- whether or not the option should be enabled.- Returns:
- the current
StompServerOptions
-
isSendErrorOnNoSubscriptions
public boolean isSendErrorOnNoSubscriptions()Checks whether or not an error is sent to the client when this client sends a message to an not subscribed destinations (no subscriptions on this destination).- Returns:
- whether or not the option is enabled.
-
setSendErrorOnNoSubscriptions
Sets whether or not an error is sent to the client when this client sends a message to an not subscribed destinations (no subscriptions on this destination).- Parameters:
sendErrorOnNoSubscriptions- whether or not the option should be enabled.- Returns:
- the current
StompServerOptions
-
getTimeFactor
public int getTimeFactor()Gets the time factor, i.e. a multiplier applied to time constraints as a window error. 1 by default.- Returns:
- the time factor.
-
setTimeFactor
Sets the time factor.- Parameters:
timeFactor- the time factor- Returns:
- the current
StompServerOptions
-
setSsl
Description copied from class:TCPSSLOptionsSet whether SSL/TLS is enabled- Overrides:
setSslin classNetServerOptions- Parameters:
ssl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setPort
Sets the port on which the server is going to listen for TCP connection.- Overrides:
setPortin classNetServerOptions- Parameters:
port- the port number,-1to disable the TCP server.- Returns:
- the current
StompServerOptions.
-
getPort
public int getPort()- Overrides:
getPortin classNetServerOptions- Returns:
- the port, -1 if the TCP server has been disabled.
-
setHost
Description copied from class:NetServerOptionsSet the host- Overrides:
setHostin classNetServerOptions- Parameters:
host- the host- Returns:
- a reference to this, so the API can be used fluently
-
getHeartbeat
Gets the heartbeat configuration. Defaults tox: 1000, y: 1000.- Returns:
- the heartbeat configuration.
- See Also:
-
setHeartbeat
Sets the heartbeat configuration.- Parameters:
heartbeat- the heartbeat configuration- Returns:
- the current
StompServerOptions - See Also:
-
getMaxFrameInTransaction
public int getMaxFrameInTransaction()Gets the maximum number of frames that can be added to a transaction. If the number of frame added to a transaction exceeds this threshold, the client receives anERRORframe and is disconnected.- Returns:
- the max number of frame in transaction
-
setMaxFrameInTransaction
Sets the maximum number of frame that can be added in a transaction. If the number of frame added to a transaction exceeds this threshold, the client receives anERRORframe and is disconnected. The default is 1000.- Parameters:
maxFrameInTransaction- the max number of frame- Returns:
- the current
StompServerOptions
-
getTransactionChunkSize
public int getTransactionChunkSize()Gets the chunk size when replaying a transaction. To avoid blocking the event loop for too long, large transactions are split into chunks, replayed one by one. This settings gets the chunk size.- Returns:
- the size of the chunk
-
setTransactionChunkSize
Sets the chunk size when replaying a transaction. To avoid blocking the event loop for too long, large transactions are split into chunks, replayed one by one. This settings sets the chunk size.- Parameters:
transactionChunkSize- the size, must be strictly positive- Returns:
- the current
StompServerOptions
-
getMaxSubscriptionsByClient
public int getMaxSubscriptionsByClient()Gets the maximum of subscriptions a client is allowed to register. If a client exceeds this number, it receives an error and the connection is closed.- Returns:
- the max number of subscriptions per client
-
setMaxSubscriptionsByClient
Sets the maximum of subscriptions a client is allowed to register. If a client exceeds this number, it receives an error and the connection is closed.- Parameters:
maxSubscriptionsByClient- the max number of subscriptions- Returns:
- the current
StompServerOptions
-
isWebsocketBridge
public boolean isWebsocketBridge()Checks whether or not the web socket bridge is enabled. This bridge allows receiving and sending STOMP frames on a web socket. If set totrue, the Stomp server provides aHandler<ServerWebSocket>to read and write from the web socket. ThisHandlermust be passed toHttpServer.webSocketHandler(Handler).- Returns:
- whether or not the web socket bridge is enabled,
falseby default.
-
setWebsocketBridge
Enables or disables the web socket bridge.- Parameters:
websocketBridge- whether or not the web socket bridge should be enabled.- Returns:
- the current
StompServerOptions
-
getWebsocketPath
Gets the path for the web socket. Only web sockets frame receiving on this path would be handled. By default it'sDEFAULT_WEBSOCKET_PATH. The returned String is not a prefix but an exact match.- Returns:
- the path
-
setWebsocketPath
Sets the websocket path. Only frames received on this path would be considered as STOMP frame.- Parameters:
websocketPath- the path, must not benull.- Returns:
- the current
StompServerOptions
-
isTrailingLine
public boolean isTrailingLine()Gets whether or not an empty line should be appended to the written STOMP frame. This option is disabled by default. This option is not compliant with the STOMP specification, and so is not documented on purpose.- Returns:
- whether or not an empty line should be appended to the written STOMP frame.
-
setTrailingLine
Sets whether or not an empty line should be appended to the written STOMP frame. This option is disabled by default. This option is not compliant with the STOMP specification, and so is not documented on purpose.- Parameters:
trailingLine-trueto add an empty line,falseotherwise- Returns:
- the current
StompServerOptions
-
getWebSocketFrameType
Gets the WebSocket frame type to use when sending STOMP messages over WebSocket.This determines whether STOMP frames are sent as text or binary WebSocket frames. The default is
WebSocketFrameType.BINARYfor backward compatibility.Use
WebSocketFrameType.TEXTfor compatibility with JavaScript STOMP clients (e.g. StompJS) as STOMP is a text-based protocol.- Returns:
- the WebSocket frame type,
WebSocketFrameType.BINARYby default
-
setWebSocketFrameType
Sets the WebSocket frame type to use when sending STOMP messages over WebSocket.This determines whether STOMP frames are sent as text or binary WebSocket frames.
WebSocketFrameType.TEXT- Recommended for JavaScript clients and aligns with STOMP being a text-based protocol. Note that STOMP message bodies containing binary data must be UTF-8 safe or Base64 encoded at the application level.WebSocketFrameType.BINARY- Legacy behavior, handles any content but may not be compatible with some JavaScript STOMP clients.
- Parameters:
webSocketFrameType- the frame type to use- Returns:
- the current
StompServerOptions
-