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 booleanDEFAULT_AUTOMATIC_RECOVERY_ENABLEDThe default automatic recovery enabled =falsestatic booleanDEFAULT_AUTOMATIC_RECOVERY_ON_INITIAL_CONNECTIONThe default automatic recovery on initial connection =truestatic StringDEFAULT_CONNECTION_NAMEThe default connection name =VertxRabbitMQstatic intDEFAULT_CONNECTION_TIMEOUTThe default connection timeout =60000static intDEFAULT_HANDSHAKE_TIMEOUTThe default handshake timeout =10000static StringDEFAULT_HOSTThe default host =localhoststatic longDEFAULT_NETWORK_RECOVERY_INTERNALThe default network recovery internal =5000static StringDEFAULT_PASSWORDThe default password =gueststatic intDEFAULT_PORTThe default port =- 1-5671for SSL otherwise5672static longDEFAULT_RECONNECT_INTERVALThe default connection retry delay =10000static intDEFAULT_REQUESTED_CHANNEL_MAXThe default requested channel max =0static intDEFAULT_REQUESTED_HEARTBEATThe default connection timeout =60static booleanDEFAULT_USE_NIO_SOCKETSThe default use nio sockets =falsestatic StringDEFAULT_USERThe default user =gueststatic StringDEFAULT_VIRTUAL_HOSTThe 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()StringgetConnectionName()intgetConnectionTimeout()com.rabbitmq.client.impl.CredentialsProvidergetCredentialsProvider()com.rabbitmq.client.impl.CredentialsRefreshServicegetCredentialsRefreshService()intgetHandshakeTimeout()StringgetHost()booleangetIncludeProperties()com.rabbitmq.client.MetricsCollectorgetMetricsCollector()longgetNetworkRecoveryInterval()StringgetPassword()intgetPort()intgetRequestedChannelMax()intgetRequestedHeartbeat()com.rabbitmq.client.DefaultSaslConfiggetSaslConfig()StringgetUri()StringgetUser()StringgetVirtualHost()booleanisAutomaticRecoveryEnabled()booleanisAutomaticRecoveryOnInitialConnection()booleanisNioEnabled()RabbitMQOptionssetAddresses(List<com.rabbitmq.client.Address> addresses)Set multiple addresses for cluster mode.RabbitMQOptionssetAutomaticRecoveryEnabled(boolean automaticRecoveryEnabled)Enables or disables automatic connection recovery.RabbitMQOptionssetAutomaticRecoveryOnInitialConnection(boolean automaticRecoveryOnInitialConnection)Enable or disable automatic recovery on initial connections.RabbitMQOptionssetConnectionName(String connectionName)RabbitMQOptionssetConnectionTimeout(int connectionTimeout)Set the TCP connection timeout, in milliseconds,zerofor infinite).RabbitMQOptionssetCredentialsProvider(com.rabbitmq.client.impl.CredentialsProvider credentialsProvider)Provides a RabbitMQ credentials provider for using dynamic credentials.RabbitMQOptionssetCredentialsRefreshService(com.rabbitmq.client.impl.CredentialsRefreshService credentialsRefreshService)Provides a RabbitMQ credentials refresh service for refreshing dynamic credentials.RabbitMQOptionssetHandshakeTimeout(int handshakeTimeout)Set the AMQP 0-9-1 protocol handshake timeout, in millisecondsRabbitMQOptionssetHost(String host)Set the default host to use for connections.RabbitMQOptionssetHostnameVerificationAlgorithm(String algorithm)Set the hostname verification algorithm interval To disable hostname verification, set hostnameVerificationAlgorithm to an empty StringRabbitMQOptionssetIncludeProperties(boolean includeProperties)Set wether to include properties when a broker message is passed on the event busRabbitMQOptionssetKeyCertOptions(KeyCertOptions options)Set the key/cert options.RabbitMQOptionssetMetricsCollector(com.rabbitmq.client.MetricsCollector metricsCollector)Provides a metrics collector for RabbitMQ.RabbitMQOptionssetNetworkRecoveryInterval(long networkRecoveryInterval)Set how long in milliseconds will automatic recovery wait before attempting to reconnect, default is5000RabbitMQOptionssetPassword(String password)Set the password to use when connecting to the broker.RabbitMQOptionssetPort(int port)Set the default port to use for connections.RabbitMQOptionssetReconnectAttempts(int attempts)Set the value of reconnect attemptsRabbitMQOptionssetReconnectInterval(long interval)Set the reconnect intervalRabbitMQOptionssetRequestedChannelMax(int requestedChannelMax)Set the initially requested maximum channel number,zerofor unlimited.RabbitMQOptionssetRequestedHeartbeat(int requestedHeartbeat)Set the initially requested heartbeat interval, in seconds,zerofor none.RabbitMQOptionssetSaslConfig(com.rabbitmq.client.DefaultSaslConfig saslConfig)Set the SASL mechanism for rabbitmq authenticationRabbitMQOptionssetSsl(boolean ssl)Set whether SSL/TLS is enabledRabbitMQOptionssetTrustAll(boolean trustAll)Set whether all server certificates should be trustedRabbitMQOptionssetTrustOptions(TrustOptions options)Set the trust options.RabbitMQOptionssetUri(String uri)RabbitMQOptionssetUseNio(boolean useNio)Enables or disables usage of NIO Sockets.RabbitMQOptionssetUser(String user)Set the AMQP user name to use when connecting to the broker.RabbitMQOptionssetVirtualHost(String virtualHost)Set the virtual host to use when connecting to the broker.JsonObjecttoJson()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-5671for 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:ClientOptionsBaseConvert to JSON- Overrides:
toJsonin 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,zerofor 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,zerofor 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,zerofor 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:
trueif automatic connection recovery is enabled,falseotherwise
-
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:
trueif NIO Sockets are enabled,falseotherwise
-
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:NetClientOptionsSet the value of reconnect attempts- Overrides:
setReconnectAttemptsin 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:NetClientOptionsSet the reconnect interval- Overrides:
setReconnectIntervalin 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:TCPSSLOptionsSet whether SSL/TLS is enabled- Overrides:
setSslin 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:ClientOptionsBaseSet whether all server certificates should be trusted- Overrides:
setTrustAllin 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:TCPSSLOptionsSet the key/cert options.- Overrides:
setKeyCertOptionsin 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:TCPSSLOptionsSet the trust options.- Overrides:
setTrustOptionsin 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:NetClientOptionsSet the hostname verification algorithm interval To disable hostname verification, set hostnameVerificationAlgorithm to an empty String- Overrides:
setHostnameVerificationAlgorithmin 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)
-
-