Class StompClientOptions

All Implemented Interfaces:
StompOptions

public class StompClientOptions extends NetClientOptions implements StompOptions
Options used to configure a STOMP client. As a STOMP client wraps a Net client, you can also configure the underlying NET client.
Author:
Clement Escoffier
  • Field Details

    • DEFAULT_MAX_HEADER_LINE_LENGTH

      public static final int DEFAULT_MAX_HEADER_LINE_LENGTH
      See Also:
    • 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:
  • Constructor Details

    • StompClientOptions

      public StompClientOptions()
      Default constructor.
    • StompClientOptions

      public StompClientOptions(StompClientOptions other)
      Copy constructor.
      Parameters:
      other - The other StompServerOptions to copy when creating this
    • StompClientOptions

      public StompClientOptions(JsonObject json)
      Creates an instance from a JsonObject.
      Parameters:
      json - the JsonObject to create it from
  • Method Details

    • toJson

      public JsonObject toJson()
      Description copied from class: ClientOptionsBase
      Convert to JSON
      Overrides:
      toJson in class NetClientOptions
      Returns:
      a JSON representation of the options.
    • getMaxHeaderLineLength

      public int getMaxHeaderLineLength()
      Gets the maximum byte length of a single line (command or header line) accepted before the body section. Defaults to DEFAULT_MAX_HEADER_LINE_LENGTH.
      Returns:
      the max header line length in bytes
    • setMaxHeaderLineLength

      public StompClientOptions setMaxHeaderLineLength(int maxHeaderLineLength)
      Sets the maximum byte length of a single line (command or header line) accepted before the body section. This bounds byte accumulation in the frame parser when receiving frames from a server. Set to 0 or a negative value to disable the limit.
      Parameters:
      maxHeaderLineLength - the max line length in bytes
      Returns:
      the current StompClientOptions
    • getMaxHeaderLength

      public int getMaxHeaderLength()
      Gets the maximum length of a header name or value accepted by the client. If either exceeds this length, the frame is rejected and the connection is closed. Defaults to DEFAULT_MAX_HEADER_LENGTH.
      Returns:
      the max header name/value length in bytes
    • setMaxHeaderLength

      public StompClientOptions setMaxHeaderLength(int maxHeaderLength)
      Sets the maximum length of a header name or value accepted by the client.
      Parameters:
      maxHeaderLength - the max header name/value length in bytes
      Returns:
      the current StompClientOptions
    • getMaxHeaders

      public int getMaxHeaders()
      Gets the maximum number of headers accepted per frame. If a frame exceeds this count, it is rejected and the connection is closed. Defaults to DEFAULT_MAX_HEADERS.
      Returns:
      the max number of headers per frame
    • setMaxHeaders

      public StompClientOptions setMaxHeaders(int maxHeaders)
      Sets the maximum number of headers accepted per frame.
      Parameters:
      maxHeaders - the max number of headers per frame
      Returns:
      the current StompClientOptions
    • getMaxBodyLength

      public int getMaxBodyLength()
      Gets the maximum body length accepted by the client. If a frame body exceeds this size, the frame is rejected and the connection is closed. Defaults to DEFAULT_MAX_BODY_LENGTH.
      Returns:
      the max body length in bytes
    • setMaxBodyLength

      public StompClientOptions setMaxBodyLength(int maxBodyLength)
      Sets the maximum body length accepted by the client.
      Parameters:
      maxBodyLength - the max body length in bytes
      Returns:
      the current StompClientOptions
    • getHost

      public String getHost()
      Gets the STOMP server host.
      Returns:
      the STOMP server host
    • setHost

      public StompClientOptions setHost(String host)
      Sets the STOMP server host. 0.0.0.0 by default.
      Parameters:
      host - the host name of the STOMP server
      Returns:
      the current StompClientOptions
    • getLogin

      public String getLogin()
      Gets the configured login.
      Returns:
      the login
    • setLogin

      public StompClientOptions setLogin(String login)
      Sets the login to use if the STOMP server is secured.
      Parameters:
      login - the login
      Returns:
      the current StompClientOptions
    • getPasscode

      public String getPasscode()
      Gets the configured passcode.
      Returns:
      the passcode
    • setPasscode

      public StompClientOptions setPasscode(String passcode)
      Sets the passcode to use if the STOMP server is secured.
      Parameters:
      passcode - the passcode
      Returns:
      the current StompClientOptions
    • getPort

      public int getPort()
      Gets the STOMP server port.
      Returns:
      the port
    • setPort

      public StompClientOptions setPort(int port)
      Sets the STOMP server port. 61613 by default.
      Parameters:
      port - the port
      Returns:
      the current StompClientOptions
    • getAcceptedVersions

      public List<String> getAcceptedVersions()
      Gets the list of STOMP protocol versions accepted by the client.
      Returns:
      the list of accepted version
    • setAcceptedVersions

      public StompClientOptions setAcceptedVersions(List<String> acceptedVersions)
      Sets the list of STOMP protocol versions accepted by the client. The list must be ordered from the lowest version to the highest. By default the following list is used: 1.0, 1.1, 1.2
      Parameters:
      acceptedVersions - the order list of accepted versions
      Returns:
      the current StompClientOptions
    • isAutoComputeContentLength

      public boolean isAutoComputeContentLength()
      Whether or not the automatic computation of the content-length header is enabled.
      Returns:
      whether or not the option is enabled
    • setAutoComputeContentLength

      public StompClientOptions setAutoComputeContentLength(boolean autoComputeContentLength)
      Sets whether or not the automatic computation of the content-length header is enabled. If enabled, the content-length header is set in all frame with a body that do not explicitly set the header. The option is enabled by default.
      Parameters:
      autoComputeContentLength - true to enable the option, false to disable it.
      Returns:
      the current StompClientOptions
    • isUseStompFrame

      public boolean isUseStompFrame()
      Checks whether or not the connection is made using the STOMP command instead of the CONNECT command. The STOMP command has been introduced in the 1.2 version of the protocol to ease the network analysis (as CONNECT is also used by HTTP. To be compliant with server not implementing the 1.2 specification, this option should be disabled.
      Returns:
      whether or not the option is enabled
    • setUseStompFrame

      public StompClientOptions setUseStompFrame(boolean useStompFrame)
      Sets whether or not the connection is made using the STOMP command instead of the CONNECT command. The STOMP command has been introduced in the 1.2 version of the protocol to ease the network analysis (as CONNECT is also used by HTTP. To be compliant with server not implementing the 1.2 specification, this option should be disabled. This option is disabled by default.
      Parameters:
      useStompFrame - true to enable the option, false to disable it.
      Returns:
      the current StompClientOptions
    • setSsl

      public StompClientOptions setSsl(boolean ssl)
      Description copied from class: TCPSSLOptions
      Set whether SSL/TLS is enabled
      Overrides:
      setSsl in class NetClientOptions
      Parameters:
      ssl - true if enabled
      Returns:
      a reference to this, so the API can be used fluently
    • isBypassHostHeader

      public boolean isBypassHostHeader()
      Checks whether or not the host header must be dropped from the CONNECT/STOMP frame. Server may be picky about this header (such as RabbitMQ that does not support it).
      Returns:
      whether or not the option is enabled
    • setBypassHostHeader

      public StompClientOptions setBypassHostHeader(boolean bypassHostHeader)
      Sets whether or not the host header must be dropped from the CONNECT/STOMP frame. Server may be picky about this header (such as RabbitMQ that does not support it). Options disabled by default.
      Parameters:
      bypassHostHeader - true to enable the option, false to disable it.
      Returns:
      the current StompClientOptions
    • getHeartbeat

      public JsonObject getHeartbeat()
      Gets the heartbeat configuration.
      Returns:
      the heartbeat configuration
      See Also:
    • setHeartbeat

      public StompClientOptions setHeartbeat(JsonObject heartbeat)
      Sets the heartbeat configuration.
      Parameters:
      heartbeat - the configuration
      Returns:
      the current StompClientOptions
      See Also:
    • getVirtualHost

      public String getVirtualHost()
      Gets the virtual host that would be use a "host" header value in the `CONNECT` frame. This option is useful for Cloud AMQP.
      Returns:
      the virtual host
    • setVirtualHost

      public StompClientOptions setVirtualHost(String virtualHost)
      Sets the virtual host that will be used as "host" header value in the `CONNECT` frame.
      Parameters:
      virtualHost - the virtual host
      Returns:
      the current StompClientOptions
    • 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

      public StompClientOptions setTrailingLine(boolean trailingLine)
      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 - true to add an empty line, false otherwise
      Returns:
      the current StompClientOptions