Package com.rabbitmq.client
Class ConnectionFactoryConfigurator
java.lang.Object
com.rabbitmq.client.ConnectionFactoryConfigurator
Helper class to load
ConnectionFactory
settings from a property file.
The authorised keys are the constants values in this class (e.g. USERNAME).
The property file/properties instance/map instance keys can have
a prefix, the default being rabbitmq.
.
Property files can be loaded from the file system (the default),
but also from the classpath, by using the classpath:
prefix
in the location.
Client properties can be set by using
the client.properties.
prefix, e.g. client.properties.app.name
.
Default client properties and custom client properties are merged. To remove
a default client property, set its key to an empty value.
- Since:
- 5.1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static KeyManager[]
configureKeyManagers
(String keystore, String keystorePassword, String keystoreType, String keystoreAlgorithm) private static TrustManager[]
configureTrustManagers
(String truststore, String truststorePassword, String truststoreType, String truststoreAlgorithm) static void
load
(ConnectionFactory connectionFactory, String propertyFileLocation) static void
load
(ConnectionFactory cf, String propertyFileLocation, String prefix) static void
load
(ConnectionFactory connectionFactory, Map<String, String> properties) static void
static void
load
(ConnectionFactory connectionFactory, Properties properties) static void
load
(ConnectionFactory connectionFactory, Properties properties, String prefix) private static InputStream
loadResource
(String location) static String
static String
private static void
setUpBasicSsl
(ConnectionFactory cf, boolean validateServerCertificate, boolean verifyHostname, String sslAlgorithm) private static void
private static void
useDefaultTrustStore
(ConnectionFactory cf, String sslAlgorithm, boolean verifyHostname)
-
Field Details
-
DEFAULT_PREFIX
- See Also:
-
USERNAME
- See Also:
-
PASSWORD
- See Also:
-
VIRTUAL_HOST
- See Also:
-
HOST
- See Also:
-
PORT
- See Also:
-
CONNECTION_CHANNEL_MAX
- See Also:
-
CONNECTION_FRAME_MAX
- See Also:
-
CONNECTION_HEARTBEAT
- See Also:
-
CONNECTION_TIMEOUT
- See Also:
-
HANDSHAKE_TIMEOUT
- See Also:
-
SHUTDOWN_TIMEOUT
- See Also:
-
CLIENT_PROPERTIES_PREFIX
- See Also:
-
CONNECTION_RECOVERY_ENABLED
- See Also:
-
TOPOLOGY_RECOVERY_ENABLED
- See Also:
-
CONNECTION_RECOVERY_INTERVAL
- See Also:
-
CHANNEL_RPC_TIMEOUT
- See Also:
-
CHANNEL_SHOULD_CHECK_RPC_RESPONSE_TYPE
- See Also:
-
USE_NIO
- See Also:
-
NIO_READ_BYTE_BUFFER_SIZE
- See Also:
-
NIO_WRITE_BYTE_BUFFER_SIZE
- See Also:
-
NIO_NB_IO_THREADS
- See Also:
-
NIO_WRITE_ENQUEUING_TIMEOUT_IN_MS
- See Also:
-
NIO_WRITE_QUEUE_CAPACITY
- See Also:
-
SSL_ALGORITHM
- See Also:
-
SSL_ENABLED
- See Also:
-
SSL_KEY_STORE
- See Also:
-
SSL_KEY_STORE_PASSWORD
- See Also:
-
SSL_KEY_STORE_TYPE
- See Also:
-
SSL_KEY_STORE_ALGORITHM
- See Also:
-
SSL_TRUST_STORE
- See Also:
-
SSL_TRUST_STORE_PASSWORD
- See Also:
-
SSL_TRUST_STORE_TYPE
- See Also:
-
SSL_TRUST_STORE_ALGORITHM
- See Also:
-
SSL_VALIDATE_SERVER_CERTIFICATE
- See Also:
-
SSL_VERIFY_HOSTNAME
- See Also:
-
ALIASES
-
-
Constructor Details
-
ConnectionFactoryConfigurator
public ConnectionFactoryConfigurator()
-
-
Method Details
-
load
public static void load(ConnectionFactory cf, String propertyFileLocation, String prefix) throws IOException - Throws:
IOException
-
loadResource
- Throws:
FileNotFoundException
-
load
-
setUpSsl
-
configureKeyManagers
private static KeyManager[] configureKeyManagers(String keystore, String keystorePassword, String keystoreType, String keystoreAlgorithm) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException -
configureTrustManagers
private static TrustManager[] configureTrustManagers(String truststore, String truststorePassword, String truststoreType, String truststoreAlgorithm) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException -
setUpBasicSsl
private static void setUpBasicSsl(ConnectionFactory cf, boolean validateServerCertificate, boolean verifyHostname, String sslAlgorithm) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException -
useDefaultTrustStore
private static void useDefaultTrustStore(ConnectionFactory cf, String sslAlgorithm, boolean verifyHostname) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException -
load
public static void load(ConnectionFactory connectionFactory, String propertyFileLocation) throws IOException - Throws:
IOException
-
load
-
load
-
load
-
lookUp
-
lookUp
-