public class RabbitConnectionFactoryBean
extends org.springframework.beans.factory.config.AbstractFactoryBean<com.rabbitmq.client.ConnectionFactory>
sslPropertiesLocation
is not null, the default implementation loads a PKCS12
keystore and a
JKS
truststore using the supplied properties and intializes SunX509
key
and trust manager factories. These are then used to initialize an SSLContext
using the sslAlgorithm
(default TLSv1.1).
Override createSSLContext()
to create and/or perform further modification of the context.
Override setUpSSL()
to take complete control over setting up SSL.
Modifier and Type | Field and Description |
---|---|
protected com.rabbitmq.client.ConnectionFactory |
connectionFactory |
Constructor and Description |
---|
RabbitConnectionFactoryBean() |
Modifier and Type | Method and Description |
---|---|
protected com.rabbitmq.client.ConnectionFactory |
createInstance() |
protected javax.net.ssl.SSLContext |
createSSLContext()
Override this method to create and/or configure the
SSLContext used
by the ConnectionFactory . |
protected java.lang.String |
getKeyStore() |
protected java.lang.String |
getKeyStorePassphrase() |
protected org.springframework.core.io.Resource |
getKeyStoreResource() |
protected java.lang.String |
getKeyStoreType()
Get the key store type - this defaults to PKCS12 if not overridden by
setSslPropertiesLocation(Resource) or setKeyStoreType(java.lang.String) . |
java.lang.Class<?> |
getObjectType() |
protected java.security.SecureRandom |
getSecureRandom() |
protected java.lang.String |
getSslAlgorithm() |
protected org.springframework.core.io.Resource |
getSslPropertiesLocation() |
protected java.lang.String |
getTrustStore() |
protected java.lang.String |
getTrustStorePassphrase() |
protected org.springframework.core.io.Resource |
getTrustStoreResource() |
protected java.lang.String |
getTrustStoreType()
Get the trust store type - this defaults to JKS if not overridden by
setSslPropertiesLocation(Resource) or setTrustStoreType(java.lang.String) . |
boolean |
isSkipServerCertificateValidation()
Whether or not Server Side certificate has to be validated or not.
|
protected boolean |
isUseSSL() |
void |
setAutomaticRecoveryEnabled(boolean automaticRecoveryEnabled)
Set to true to enable amqp-client automatic recovery.
|
void |
setChannelRpcTimeout(int channelRpcTimeout) |
void |
setClientProperties(java.util.Map<java.lang.String,java.lang.Object> clientProperties)
Add custom client properties.
|
void |
setConnectionTimeout(int connectionTimeout) |
void |
setExceptionHandler(com.rabbitmq.client.ExceptionHandler exceptionHandler) |
void |
setHost(java.lang.String host) |
void |
setKeyStore(java.lang.String keyStore)
Set the key store resource (e.g.
|
void |
setKeyStorePassphrase(java.lang.String keyStorePassphrase)
Set the key store pass phrase - overrides
the property in
setSslPropertiesLocation(Resource) . |
void |
setKeyStoreResource(org.springframework.core.io.Resource keyStoreResource)
Set a Resource pointing to the key store.
|
void |
setKeyStoreType(java.lang.String keyStoreType)
Set the key store type - overrides
the property in
setSslPropertiesLocation(Resource) . |
void |
setMetricsCollector(com.rabbitmq.client.MetricsCollector metricsCollector) |
void |
setNioParams(com.rabbitmq.client.impl.nio.NioParams nioParams) |
void |
setPassword(java.lang.String password) |
void |
setPort(int port) |
void |
setRequestedChannelMax(int requestedChannelMax) |
void |
setRequestedFrameMax(int requestedFrameMax) |
void |
setRequestedHeartbeat(int requestedHeartbeat) |
void |
setSaslConfig(com.rabbitmq.client.SaslConfig saslConfig) |
void |
setSecureRandom(java.security.SecureRandom secureRandom)
Set the secure random to use when initializing the
SSLContext . |
void |
setSharedExecutor(java.util.concurrent.ExecutorService executor) |
void |
setSkipServerCertificateValidation(boolean skipServerCertificateValidation)
Whether or not Server Side certificate has to be validated or not.
|
void |
setSocketConfigurator(com.rabbitmq.client.SocketConfigurator socketConfigurator) |
void |
setSocketFactory(javax.net.SocketFactory factory) |
void |
setSslAlgorithm(java.lang.String sslAlgorithm)
Set the algorithm to use; default TLSv1.1.
|
void |
setSslPropertiesLocation(org.springframework.core.io.Resource sslPropertiesLocation)
When
setUseSSL(boolean) is true, the SSL properties to use (optional). |
void |
setThreadFactory(java.util.concurrent.ThreadFactory threadFactory) |
void |
setTopologyRecoveryEnabled(boolean topologyRecoveryEnabled)
Set to true to enable amqp-client topology recovery.
|
void |
setTrustStore(java.lang.String trustStore)
Set the key store resource (e.g.
|
void |
setTrustStorePassphrase(java.lang.String trustStorePassphrase)
Set the trust store pass phrase - overrides
the property in
setSslPropertiesLocation(Resource) . |
void |
setTrustStoreResource(org.springframework.core.io.Resource trustStoreResource)
Set a Resource pointing to the trust store.
|
void |
setTrustStoreType(java.lang.String trustStoreType)
Set the trust store type - overrides
the property in
setSslPropertiesLocation(Resource) . |
protected void |
setUpSSL()
Override this method to take complete control over the SSL setup.
|
void |
setUri(java.lang.String uriString) |
void |
setUri(java.net.URI uri) |
void |
setUseNio(boolean useNio)
Whether or not the factory should be configured to use Java NIO.
|
void |
setUsername(java.lang.String username) |
void |
setUseSSL(boolean useSSL)
Whether or not the factory should be configured to use SSL.
|
void |
setVirtualHost(java.lang.String virtualHost) |
protected final com.rabbitmq.client.ConnectionFactory connectionFactory
public boolean isSkipServerCertificateValidation()
public void setSkipServerCertificateValidation(boolean skipServerCertificateValidation)
skipServerCertificateValidation
- Flag to override Server side certificate checks;
if set to true
TrustEverythingTrustManager
would be used.TrustEverythingTrustManager
public void setUseSSL(boolean useSSL)
useSSL
- true to use SSL.protected boolean isUseSSL()
public void setSslAlgorithm(java.lang.String sslAlgorithm)
sslAlgorithm
- the algorithm.protected java.lang.String getSslAlgorithm()
public void setSslPropertiesLocation(org.springframework.core.io.Resource sslPropertiesLocation)
setUseSSL(boolean)
is true, the SSL properties to use (optional).
Resource referencing a properties file with the following properties:
If this is provided, its properties (if present) will override the explicitly set property in this bean.
sslPropertiesLocation
- the Resource to the ssl propertiesprotected org.springframework.core.io.Resource getSslPropertiesLocation()
protected java.lang.String getKeyStore()
public void setKeyStore(java.lang.String keyStore)
setSslPropertiesLocation(Resource)
.
Ignored if setTrustStoreResource(Resource)
is called with a
resource.keyStore
- the keystore resource.protected org.springframework.core.io.Resource getKeyStoreResource()
public void setKeyStoreResource(org.springframework.core.io.Resource keyStoreResource)
keyStoreResource
- the resource.protected java.lang.String getTrustStore()
public void setTrustStore(java.lang.String trustStore)
setSslPropertiesLocation(Resource)
.
Ignored if setTrustStoreResource(Resource)
is called with a
resource.trustStore
- the truststore resource.protected org.springframework.core.io.Resource getTrustStoreResource()
public void setTrustStoreResource(org.springframework.core.io.Resource trustStoreResource)
trustStoreResource
- the resource.protected java.lang.String getKeyStorePassphrase()
public void setKeyStorePassphrase(java.lang.String keyStorePassphrase)
setSslPropertiesLocation(Resource)
.keyStorePassphrase
- the key store pass phrase.protected java.lang.String getTrustStorePassphrase()
public void setTrustStorePassphrase(java.lang.String trustStorePassphrase)
setSslPropertiesLocation(Resource)
.trustStorePassphrase
- the trust store pass phrase.protected java.lang.String getKeyStoreType()
setSslPropertiesLocation(Resource)
or setKeyStoreType(java.lang.String)
.public void setKeyStoreType(java.lang.String keyStoreType)
setSslPropertiesLocation(Resource)
.keyStoreType
- the key store type.KeyStore.getInstance(String)
protected java.lang.String getTrustStoreType()
setSslPropertiesLocation(Resource)
or setTrustStoreType(java.lang.String)
.public void setTrustStoreType(java.lang.String trustStoreType)
setSslPropertiesLocation(Resource)
.trustStoreType
- the trust store type.KeyStore.getInstance(String)
protected java.security.SecureRandom getSecureRandom()
public void setSecureRandom(java.security.SecureRandom secureRandom)
SSLContext
.
Defaults to null, in which case the default implementation is used.secureRandom
- the secure random.SSLContext.init(KeyManager[], TrustManager[], SecureRandom)
public void setHost(java.lang.String host)
host
- the host.ConnectionFactory.setHost(java.lang.String)
public void setPort(int port)
port
- the port.ConnectionFactory.setPort(int)
public void setUsername(java.lang.String username)
username
- the user name.ConnectionFactory.setUsername(java.lang.String)
public void setPassword(java.lang.String password)
password
- the password.ConnectionFactory.setPassword(java.lang.String)
public void setVirtualHost(java.lang.String virtualHost)
virtualHost
- the virtual host.ConnectionFactory.setVirtualHost(java.lang.String)
public void setUri(java.net.URI uri)
uri
- the uri.ConnectionFactory.setUri(java.net.URI)
public void setUri(java.lang.String uriString)
uriString
- the uri.ConnectionFactory.setUri(java.lang.String)
public void setRequestedChannelMax(int requestedChannelMax)
requestedChannelMax
- the max requested channels.ConnectionFactory.setRequestedChannelMax(int)
public void setRequestedFrameMax(int requestedFrameMax)
requestedFrameMax
- the requested max frames.ConnectionFactory.setRequestedFrameMax(int)
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- the connection timeout.ConnectionFactory.setConnectionTimeout(int)
public void setRequestedHeartbeat(int requestedHeartbeat)
requestedHeartbeat
- the requested heartbeat.ConnectionFactory.setRequestedHeartbeat(int)
public void setClientProperties(java.util.Map<java.lang.String,java.lang.Object> clientProperties)
clientProperties
- the client properties.ConnectionFactory.setClientProperties(java.util.Map)
public void setSaslConfig(com.rabbitmq.client.SaslConfig saslConfig)
saslConfig
- the sasl config.ConnectionFactory.setSaslConfig(com.rabbitmq.client.SaslConfig)
public void setSocketFactory(javax.net.SocketFactory factory)
factory
- the socket factory.ConnectionFactory.setSocketFactory(javax.net.SocketFactory)
public void setSocketConfigurator(com.rabbitmq.client.SocketConfigurator socketConfigurator)
socketConfigurator
- the socket configurator.ConnectionFactory.setSocketConfigurator(com.rabbitmq.client.SocketConfigurator)
public void setSharedExecutor(java.util.concurrent.ExecutorService executor)
executor
- the executor serviceConnectionFactory.setSharedExecutor(java.util.concurrent.ExecutorService)
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
threadFactory
- the thread factory.ConnectionFactory.setThreadFactory(java.util.concurrent.ThreadFactory)
public void setExceptionHandler(com.rabbitmq.client.ExceptionHandler exceptionHandler)
exceptionHandler
- the exception handler.ConnectionFactory.setExceptionHandler(com.rabbitmq.client.ExceptionHandler)
public void setUseNio(boolean useNio)
useNio
- true to use Java NIO, false to use blocking IOConnectionFactory.useNio()
public void setNioParams(com.rabbitmq.client.impl.nio.NioParams nioParams)
nioParams
- the NIO parametersConnectionFactory.setNioParams(com.rabbitmq.client.impl.nio.NioParams)
public void setMetricsCollector(com.rabbitmq.client.MetricsCollector metricsCollector)
metricsCollector
- the metrics collector instanceConnectionFactory.setMetricsCollector(MetricsCollector)
public void setAutomaticRecoveryEnabled(boolean automaticRecoveryEnabled)
automaticRecoveryEnabled
- true to enable.public void setTopologyRecoveryEnabled(boolean topologyRecoveryEnabled)
topologyRecoveryEnabled
- true to enable.public void setChannelRpcTimeout(int channelRpcTimeout)
channelRpcTimeout
- continuation timeout for RPC calls in channelsConnectionFactory.setChannelRpcTimeout(int)
public java.lang.Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<com.rabbitmq.client.ConnectionFactory>
getObjectType
in class org.springframework.beans.factory.config.AbstractFactoryBean<com.rabbitmq.client.ConnectionFactory>
protected com.rabbitmq.client.ConnectionFactory createInstance() throws java.lang.Exception
createInstance
in class org.springframework.beans.factory.config.AbstractFactoryBean<com.rabbitmq.client.ConnectionFactory>
java.lang.Exception
protected void setUpSSL() throws java.lang.Exception
java.lang.Exception
- an Exception.protected javax.net.ssl.SSLContext createSSLContext() throws java.security.NoSuchAlgorithmException
SSLContext
used
by the ConnectionFactory
.SSLContext
.java.security.NoSuchAlgorithmException
- if the algorithm is not available.