Class RabbitMQOptions


public class RabbitMQOptions extends NetClientOptions
RabbitMQ client options, most
Author:
Julien Viet
  • Field Details

    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      The default port = - 1 - 5671 for SSL otherwise 5672
      See Also:
    • DEFAULT_HOST

      public static final String DEFAULT_HOST
      The default host = localhost
      See Also:
    • DEFAULT_USER

      public static final String DEFAULT_USER
      The default user = guest
      See Also:
    • DEFAULT_PASSWORD

      public static final String DEFAULT_PASSWORD
      The default password = guest
      See Also:
    • DEFAULT_VIRTUAL_HOST

      public static final String DEFAULT_VIRTUAL_HOST
      The default virtual host = /
      See Also:
    • DEFAULT_CONNECTION_TIMEOUT

      public static final int DEFAULT_CONNECTION_TIMEOUT
      The default connection timeout = 60000
      See Also:
    • DEFAULT_REQUESTED_HEARTBEAT

      public static final int DEFAULT_REQUESTED_HEARTBEAT
      The default connection timeout = 60
      See Also:
    • DEFAULT_HANDSHAKE_TIMEOUT

      public static final int DEFAULT_HANDSHAKE_TIMEOUT
      The default handshake timeout = 10000
      See Also:
    • DEFAULT_REQUESTED_CHANNEL_MAX

      public static final int DEFAULT_REQUESTED_CHANNEL_MAX
      The default requested channel max = 0
      See Also:
    • DEFAULT_NETWORK_RECOVERY_INTERNAL

      public static final long DEFAULT_NETWORK_RECOVERY_INTERNAL
      The default network recovery internal = 5000
      See Also:
    • DEFAULT_AUTOMATIC_RECOVERY_ENABLED

      public static final boolean DEFAULT_AUTOMATIC_RECOVERY_ENABLED
      The default automatic recovery enabled = false
      See Also:
    • DEFAULT_AUTOMATIC_RECOVERY_ON_INITIAL_CONNECTION

      public static final boolean DEFAULT_AUTOMATIC_RECOVERY_ON_INITIAL_CONNECTION
      The default automatic recovery on initial connection = true
      See Also:
    • DEFAULT_RECONNECT_INTERVAL

      public static final long DEFAULT_RECONNECT_INTERVAL
      The default connection retry delay = 10000
      See Also:
    • DEFAULT_USE_NIO_SOCKETS

      public static final boolean DEFAULT_USE_NIO_SOCKETS
      The default use nio sockets = false
      See Also:
    • DEFAULT_CONNECTION_NAME

      public static final String DEFAULT_CONNECTION_NAME
      The default connection name = VertxRabbitMQ
      See Also:
  • Constructor Details

    • RabbitMQOptions

      public RabbitMQOptions()
    • RabbitMQOptions

      public RabbitMQOptions(JsonObject json)
    • RabbitMQOptions

      public RabbitMQOptions(RabbitMQOptions other)
  • Method Details

    • toJson

      public JsonObject toJson()
      Description copied from class: ClientOptionsBase
      Convert to JSON
      Overrides:
      toJson in class NetClientOptions
      Returns:
      the JSON
    • getAddresses

      public List<com.rabbitmq.client.Address> getAddresses()
    • setAddresses

      public RabbitMQOptions setAddresses(List<com.rabbitmq.client.Address> addresses)
      Set multiple addresses for cluster mode.
      Parameters:
      addresses - addresses of AMQP cluster
      Returns:
      a reference to this, so the API can be used fluently
    • getUri

      public String getUri()
    • setUri

      public RabbitMQOptions setUri(String uri)
    • getUser

      public String getUser()
      Returns:
      the AMQP user name to use when connecting to the broker
    • setUser

      public RabbitMQOptions setUser(String user)
      Set the AMQP user name to use when connecting to the broker.
      Parameters:
      user - the user name
      Returns:
      a reference to this, so the API can be used fluently
    • getPassword

      public String getPassword()
      Returns:
      the password to use when connecting to the broker
    • setPassword

      public RabbitMQOptions setPassword(String password)
      Set the password to use when connecting to the broker.
      Parameters:
      password - the password
      Returns:
      a reference to this, so the API can be used fluently
    • getHost

      public String getHost()
      Returns:
      the default host to use for connections
    • setHost

      public RabbitMQOptions setHost(String host)
      Set the default host to use for connections.
      Parameters:
      host - the default host
      Returns:
      a reference to this, so the API can be used fluently
    • getVirtualHost

      public String getVirtualHost()
      Returns:
      the virtual host to use when connecting to the broker
    • setVirtualHost

      public RabbitMQOptions setVirtualHost(String virtualHost)
      Set the virtual host to use when connecting to the broker.
      Parameters:
      virtualHost - the virtual host
      Returns:
      a reference to this, so the API can be used fluently
    • getPort

      public int getPort()
      Returns:
      the default port to use for connections
    • setPort

      public RabbitMQOptions setPort(int port)
      Set the default port to use for connections.
      Parameters:
      port - the default port
      Returns:
      a reference to this, so the API can be used fluently
    • getConnectionTimeout

      public int getConnectionTimeout()
      Returns:
      the TCP connection timeout
    • setConnectionTimeout

      public RabbitMQOptions setConnectionTimeout(int connectionTimeout)
      Set the TCP connection timeout, in milliseconds, zero for infinite).
      Parameters:
      connectionTimeout - the timeouut in milliseconds.
      Returns:
      a reference to this, so the API can be used fluently
    • getRequestedHeartbeat

      public int getRequestedHeartbeat()
      Returns:
      the initially requested heartbeat interval
    • setRequestedHeartbeat

      public RabbitMQOptions setRequestedHeartbeat(int requestedHeartbeat)
      Set the initially requested heartbeat interval, in seconds, zero for none.
      Parameters:
      requestedHeartbeat - the request heartbeat interval
      Returns:
      a reference to this, so the API can be used fluently
    • getHandshakeTimeout

      public int getHandshakeTimeout()
      Returns:
      the AMQP 0-9-1 protocol handshake timeout
    • setHandshakeTimeout

      public RabbitMQOptions setHandshakeTimeout(int handshakeTimeout)
      Set the AMQP 0-9-1 protocol handshake timeout, in milliseconds
      Parameters:
      handshakeTimeout - the timeout in milliseconds
      Returns:
      a reference to this, so the API can be used fluently
    • getRequestedChannelMax

      public int getRequestedChannelMax()
      Returns:
      the initially requested maximum channel number
    • setRequestedChannelMax

      public RabbitMQOptions setRequestedChannelMax(int requestedChannelMax)
      Set the initially requested maximum channel number, zero for unlimited.
      Parameters:
      requestedChannelMax - the requested maximum channel number
      Returns:
      a reference to this, so the API can be used fluently
    • getNetworkRecoveryInterval

      public long getNetworkRecoveryInterval()
      Returns:
      automatic connection recovery interval
    • setNetworkRecoveryInterval

      public RabbitMQOptions setNetworkRecoveryInterval(long networkRecoveryInterval)
      Set how long in milliseconds will automatic recovery wait before attempting to reconnect, default is 5000
      Parameters:
      networkRecoveryInterval - the connection recovery interval
      Returns:
      a reference to this, so the API can be used fluently
    • isAutomaticRecoveryEnabled

      public boolean isAutomaticRecoveryEnabled()
      Returns:
      true if automatic connection recovery is enabled, false otherwise
    • setAutomaticRecoveryEnabled

      public RabbitMQOptions setAutomaticRecoveryEnabled(boolean automaticRecoveryEnabled)
      Enables or disables automatic connection recovery.
      Parameters:
      automaticRecoveryEnabled - if true, enables connection recovery
      Returns:
      a reference to this, so the API can be used fluently
    • isAutomaticRecoveryOnInitialConnection

      public boolean isAutomaticRecoveryOnInitialConnection()
    • setAutomaticRecoveryOnInitialConnection

      public RabbitMQOptions setAutomaticRecoveryOnInitialConnection(boolean automaticRecoveryOnInitialConnection)
      Enable or disable automatic recovery on initial connections. If automatic recovery is enabled it will, by default, make multiple attempts to connect on startup. This can cause problems with the configuration is wrong, and it is this bad configuration that is preventing connection. To work around this automaticRecoveryOnInitialConnection can be set to false (it default to true). When automaticRecoveryOnInitialConnection is false (and automaticRecoveryEnabled is true) reconnection attempts will not be made until after the first connection has been successful.
      Parameters:
      automaticRecoveryOnInitialConnection - if false, prevents automatic recovery on the first connection attempts.
      Returns:
      a reference to this, so the API can be used fluently
    • getIncludeProperties

      public boolean getIncludeProperties()
      Returns:
      wether to include properties when a broker message is passed on the event bus
    • setIncludeProperties

      public RabbitMQOptions setIncludeProperties(boolean includeProperties)
      Set wether to include properties when a broker message is passed on the event bus
      Parameters:
      includeProperties - wether to include properties
      Returns:
      a reference to this, so the API can be used fluently
    • isNioEnabled

      public boolean isNioEnabled()
      Returns:
      true if NIO Sockets are enabled, false otherwise
    • setUseNio

      public RabbitMQOptions setUseNio(boolean useNio)
      Enables or disables usage of NIO Sockets.
      Parameters:
      useNio - if true, enables NIO Sockets
      Returns:
      a reference to this, so the API can be used fluently
    • getCredentialsProvider

      public com.rabbitmq.client.impl.CredentialsProvider getCredentialsProvider()
      Returns:
      A RabbitMQ credentials provider for using dynamic credentials.
    • setCredentialsProvider

      public RabbitMQOptions setCredentialsProvider(com.rabbitmq.client.impl.CredentialsProvider credentialsProvider)
      Provides a RabbitMQ credentials provider for using dynamic credentials.
      Returns:
      a reference to this, so the API can be used fluently.
    • getCredentialsRefreshService

      public com.rabbitmq.client.impl.CredentialsRefreshService getCredentialsRefreshService()
      Returns:
      A RabbitMQ credentials refresh service for refreshing dynamic credentials.
    • setCredentialsRefreshService

      public RabbitMQOptions setCredentialsRefreshService(com.rabbitmq.client.impl.CredentialsRefreshService credentialsRefreshService)
      Provides a RabbitMQ credentials refresh service for refreshing dynamic credentials.
      Returns:
      a reference to this, so the API can be used fluently.
    • getSaslConfig

      public com.rabbitmq.client.DefaultSaslConfig getSaslConfig()
      Returns:
      The specified DefaultSaslConfiguration rabbitmq authentication mechanism
    • setSaslConfig

      public RabbitMQOptions setSaslConfig(com.rabbitmq.client.DefaultSaslConfig saslConfig)
      Set the SASL mechanism for rabbitmq authentication
      Parameters:
      saslConfig - The
      Returns:
      a reference to this, so the API can be used fluently.
    • getMetricsCollector

      public com.rabbitmq.client.MetricsCollector getMetricsCollector()
    • setMetricsCollector

      public RabbitMQOptions setMetricsCollector(com.rabbitmq.client.MetricsCollector metricsCollector)
      Provides a metrics collector for RabbitMQ.
      Returns:
      a reference to this, so the API can be used fluently.
      See Also:
    • setReconnectAttempts

      public RabbitMQOptions setReconnectAttempts(int attempts)
      Description copied from class: NetClientOptions
      Set the value of reconnect attempts
      Overrides:
      setReconnectAttempts in class NetClientOptions
      Parameters:
      attempts - the maximum number of reconnect attempts
      Returns:
      a reference to this, so the API can be used fluently
    • setReconnectInterval

      public RabbitMQOptions setReconnectInterval(long interval)
      Description copied from class: NetClientOptions
      Set the reconnect interval
      Overrides:
      setReconnectInterval in class NetClientOptions
      Parameters:
      interval - the reconnect interval in ms
      Returns:
      a reference to this, so the API can be used fluently
    • setSsl

      public RabbitMQOptions 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
    • setTrustAll

      public RabbitMQOptions setTrustAll(boolean trustAll)
      Description copied from class: ClientOptionsBase
      Set whether all server certificates should be trusted
      Overrides:
      setTrustAll in class NetClientOptions
      Parameters:
      trustAll - true if all should be trusted
      Returns:
      a reference to this, so the API can be used fluently
    • setKeyCertOptions

      public RabbitMQOptions setKeyCertOptions(KeyCertOptions options)
      Description copied from class: TCPSSLOptions
      Set the key/cert options.
      Overrides:
      setKeyCertOptions in class NetClientOptions
      Parameters:
      options - the key store options
      Returns:
      a reference to this, so the API can be used fluently
    • setTrustOptions

      public RabbitMQOptions setTrustOptions(TrustOptions options)
      Description copied from class: TCPSSLOptions
      Set the trust options.
      Overrides:
      setTrustOptions in class NetClientOptions
      Parameters:
      options - the trust options
      Returns:
      a reference to this, so the API can be used fluently
    • setHostnameVerificationAlgorithm

      public RabbitMQOptions setHostnameVerificationAlgorithm(String algorithm)
      Description copied from class: NetClientOptions
      Set the hostname verification algorithm interval To disable hostname verification, set hostnameVerificationAlgorithm to an empty String
      Overrides:
      setHostnameVerificationAlgorithm in class NetClientOptions
      Parameters:
      algorithm - should be HTTPS, LDAPS or an empty String
      Returns:
      a reference to this, so the API can be used fluently
    • getConnectionName

      public String getConnectionName()
    • setConnectionName

      public RabbitMQOptions setConnectionName(String connectionName)