Package io.vertx.rabbitmq
Class RabbitMQOptions
- java.lang.Object
-
- io.vertx.core.net.NetworkOptions
-
- io.vertx.core.net.TCPSSLOptions
-
- io.vertx.core.net.ClientOptionsBase
-
- io.vertx.core.net.NetClientOptions
-
- io.vertx.rabbitmq.RabbitMQOptions
-
public class RabbitMQOptions extends NetClientOptions
RabbitMQ client options, most- Author:
- Julien Viet
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_AUTOMATIC_RECOVERY_ENABLED
The default automatic recovery enabled =false
static boolean
DEFAULT_AUTOMATIC_RECOVERY_ON_INITIAL_CONNECTION
The default automatic recovery on initial connection =true
static String
DEFAULT_CONNECTION_NAME
The default connection name =VertxRabbitMQ
static int
DEFAULT_CONNECTION_TIMEOUT
The default connection timeout =60000
static int
DEFAULT_HANDSHAKE_TIMEOUT
The default handshake timeout =10000
static String
DEFAULT_HOST
The default host =localhost
static long
DEFAULT_NETWORK_RECOVERY_INTERNAL
The default network recovery internal =5000
static String
DEFAULT_PASSWORD
The default password =guest
static int
DEFAULT_PORT
The default port =- 1
-5671
for SSL otherwise5672
static long
DEFAULT_RECONNECT_INTERVAL
The default connection retry delay =10000
static int
DEFAULT_REQUESTED_CHANNEL_MAX
The default requested channel max =0
static int
DEFAULT_REQUESTED_HEARTBEAT
The default connection timeout =60
static boolean
DEFAULT_USE_NIO_SOCKETS
The default use nio sockets =false
static String
DEFAULT_USER
The default user =guest
static String
DEFAULT_VIRTUAL_HOST
The default virtual host =/
-
Fields inherited from class io.vertx.core.net.NetClientOptions
DEFAULT_HOSTNAME_VERIFICATION_ALGORITHM, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_REGISTER_WRITE_HANDLER
-
Fields inherited from class io.vertx.core.net.ClientOptionsBase
DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME
-
Fields inherited from class io.vertx.core.net.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_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUT
-
Fields inherited from class io.vertx.core.net.NetworkOptions
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
-
-
Constructor Summary
Constructors Constructor Description RabbitMQOptions()
RabbitMQOptions(JsonObject json)
RabbitMQOptions(RabbitMQOptions other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<com.rabbitmq.client.Address>
getAddresses()
String
getConnectionName()
int
getConnectionTimeout()
com.rabbitmq.client.impl.CredentialsProvider
getCredentialsProvider()
com.rabbitmq.client.impl.CredentialsRefreshService
getCredentialsRefreshService()
int
getHandshakeTimeout()
String
getHost()
boolean
getIncludeProperties()
com.rabbitmq.client.MetricsCollector
getMetricsCollector()
long
getNetworkRecoveryInterval()
String
getPassword()
int
getPort()
int
getRequestedChannelMax()
int
getRequestedHeartbeat()
com.rabbitmq.client.DefaultSaslConfig
getSaslConfig()
String
getUri()
String
getUser()
String
getVirtualHost()
boolean
isAutomaticRecoveryEnabled()
boolean
isAutomaticRecoveryOnInitialConnection()
boolean
isNioEnabled()
RabbitMQOptions
setAddresses(List<com.rabbitmq.client.Address> addresses)
Set multiple addresses for cluster mode.RabbitMQOptions
setAutomaticRecoveryEnabled(boolean automaticRecoveryEnabled)
Enables or disables automatic connection recovery.RabbitMQOptions
setAutomaticRecoveryOnInitialConnection(boolean automaticRecoveryOnInitialConnection)
Enable or disable automatic recovery on initial connections.RabbitMQOptions
setConnectionName(String connectionName)
RabbitMQOptions
setConnectionTimeout(int connectionTimeout)
Set the TCP connection timeout, in milliseconds,zero
for infinite).RabbitMQOptions
setCredentialsProvider(com.rabbitmq.client.impl.CredentialsProvider credentialsProvider)
Provides a RabbitMQ credentials provider for using dynamic credentials.RabbitMQOptions
setCredentialsRefreshService(com.rabbitmq.client.impl.CredentialsRefreshService credentialsRefreshService)
Provides a RabbitMQ credentials refresh service for refreshing dynamic credentials.RabbitMQOptions
setHandshakeTimeout(int handshakeTimeout)
Set the AMQP 0-9-1 protocol handshake timeout, in millisecondsRabbitMQOptions
setHost(String host)
Set the default host to use for connections.RabbitMQOptions
setHostnameVerificationAlgorithm(String algorithm)
Set the hostname verification algorithm interval To disable hostname verification, set hostnameVerificationAlgorithm to an empty StringRabbitMQOptions
setIncludeProperties(boolean includeProperties)
Set wether to include properties when a broker message is passed on the event busRabbitMQOptions
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.RabbitMQOptions
setMetricsCollector(com.rabbitmq.client.MetricsCollector metricsCollector)
Provides a metrics collector for RabbitMQ.RabbitMQOptions
setNetworkRecoveryInterval(long networkRecoveryInterval)
Set how long in milliseconds will automatic recovery wait before attempting to reconnect, default is5000
RabbitMQOptions
setPassword(String password)
Set the password to use when connecting to the broker.RabbitMQOptions
setPort(int port)
Set the default port to use for connections.RabbitMQOptions
setReconnectAttempts(int attempts)
Set the value of reconnect attemptsRabbitMQOptions
setReconnectInterval(long interval)
Set the reconnect intervalRabbitMQOptions
setRequestedChannelMax(int requestedChannelMax)
Set the initially requested maximum channel number,zero
for unlimited.RabbitMQOptions
setRequestedHeartbeat(int requestedHeartbeat)
Set the initially requested heartbeat interval, in seconds,zero
for none.RabbitMQOptions
setSaslConfig(com.rabbitmq.client.DefaultSaslConfig saslConfig)
Set the SASL mechanism for rabbitmq authenticationRabbitMQOptions
setSsl(boolean ssl)
Set whether SSL/TLS is enabledRabbitMQOptions
setTrustAll(boolean trustAll)
Set whether all server certificates should be trustedRabbitMQOptions
setTrustOptions(TrustOptions options)
Set the trust options.RabbitMQOptions
setUri(String uri)
RabbitMQOptions
setUseNio(boolean useNio)
Enables or disables usage of NIO Sockets.RabbitMQOptions
setUser(String user)
Set the AMQP user name to use when connecting to the broker.RabbitMQOptions
setVirtualHost(String virtualHost)
Set the virtual host to use when connecting to the broker.JsonObject
toJson()
Convert to JSON-
Methods inherited from class io.vertx.core.net.NetClientOptions
addCrlPath, addCrlValue, addEnabledCipherSuite, addEnabledSecureTransportProtocol, addNonProxyHost, getApplicationLayerProtocols, getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, isRegisterWriteHandler, removeEnabledCipherSuite, removeEnabledSecureTransportProtocol, setActivityLogDataFormat, setApplicationLayerProtocols, setConnectTimeout, setEnabledSecureTransportProtocols, setIdleTimeout, setIdleTimeoutUnit, setLocalAddress, setLogActivity, setMetricsName, setNonProxyHosts, setProxyOptions, setReadIdleTimeout, setReceiveBufferSize, setRegisterWriteHandler, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTrafficClass, setUseAlpn, setWriteIdleTimeout
-
Methods inherited from class io.vertx.core.net.ClientOptionsBase
getConnectTimeout, getLocalAddress, getMetricsName, getNonProxyHosts, getOrCreateSSLOptions, getProxyOptions, getSslOptions, isTrustAll, setTcpUserTimeout
-
Methods inherited from class io.vertx.core.net.TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpUserTimeout, getTrustOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn
-
Methods inherited from class io.vertx.core.net.NetworkOptions
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
-
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
The default port =- 1
-5671
for SSL otherwise5672
- See Also:
- Constant Field Values
-
DEFAULT_HOST
public static final String DEFAULT_HOST
The default host =localhost
- See Also:
- Constant Field Values
-
DEFAULT_USER
public static final String DEFAULT_USER
The default user =guest
- See Also:
- Constant Field Values
-
DEFAULT_PASSWORD
public static final String DEFAULT_PASSWORD
The default password =guest
- See Also:
- Constant Field Values
-
DEFAULT_VIRTUAL_HOST
public static final String DEFAULT_VIRTUAL_HOST
The default virtual host =/
- See Also:
- Constant Field Values
-
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT
The default connection timeout =60000
- See Also:
- Constant Field Values
-
DEFAULT_REQUESTED_HEARTBEAT
public static final int DEFAULT_REQUESTED_HEARTBEAT
The default connection timeout =60
- See Also:
- Constant Field Values
-
DEFAULT_HANDSHAKE_TIMEOUT
public static final int DEFAULT_HANDSHAKE_TIMEOUT
The default handshake timeout =10000
- See Also:
- Constant Field Values
-
DEFAULT_REQUESTED_CHANNEL_MAX
public static final int DEFAULT_REQUESTED_CHANNEL_MAX
The default requested channel max =0
- See Also:
- Constant Field Values
-
DEFAULT_NETWORK_RECOVERY_INTERNAL
public static final long DEFAULT_NETWORK_RECOVERY_INTERNAL
The default network recovery internal =5000
- See Also:
- Constant Field Values
-
DEFAULT_AUTOMATIC_RECOVERY_ENABLED
public static final boolean DEFAULT_AUTOMATIC_RECOVERY_ENABLED
The default automatic recovery enabled =false
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
DEFAULT_RECONNECT_INTERVAL
public static final long DEFAULT_RECONNECT_INTERVAL
The default connection retry delay =10000
- See Also:
- Constant Field Values
-
DEFAULT_USE_NIO_SOCKETS
public static final boolean DEFAULT_USE_NIO_SOCKETS
The default use nio sockets =false
- See Also:
- Constant Field Values
-
DEFAULT_CONNECTION_NAME
public static final String DEFAULT_CONNECTION_NAME
The default connection name =VertxRabbitMQ
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RabbitMQOptions
public RabbitMQOptions()
-
RabbitMQOptions
public RabbitMQOptions(JsonObject json)
-
RabbitMQOptions
public RabbitMQOptions(RabbitMQOptions other)
-
-
Method Detail
-
toJson
public JsonObject toJson()
Description copied from class:ClientOptionsBase
Convert to JSON- Overrides:
toJson
in classNetClientOptions
- 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 is5000
- 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
- iftrue
, 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
- iffalse
, 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
- iftrue
, 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:
- RabbitMQ Metrics and Monitoring guide
-
setReconnectAttempts
public RabbitMQOptions setReconnectAttempts(int attempts)
Description copied from class:NetClientOptions
Set the value of reconnect attempts- Overrides:
setReconnectAttempts
in classNetClientOptions
- 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 classNetClientOptions
- 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 classNetClientOptions
- 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 classNetClientOptions
- 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 classNetClientOptions
- 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 classNetClientOptions
- 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 classNetClientOptions
- 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)
-
-