Closed
Description
Discussed in #2471
Originally posted by kstojanovski-novatec June 2, 2023
I was searching for a way, how to add the SSL properties path programmatically, and after a long search ended up creating RabbitConnectionFactoryBean.
i.e.
// Possible solution for TLS / SSL
RabbitConnectionFactoryBean rabbitConnectionFactoryBean = new RabbitConnectionFactoryBean();
rabbitConnectionFactoryBean.setUseSSL(true);
// file where the SSL properties are described in
// https://docs.spring.io/spring-amqp/reference/html/#rabbitconnectionfactorybean-configuring-ssl
// keyStore, trustStore, keyStore.passPhrase, trustStore.passPhrase
rabbitConnectionFactoryBean.setSslPropertiesLocation(new ClassPathResource("ssl.properties"));
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(rabbitConnectionFactoryBean.getRabbitConnectionFactory());
Is this the correct way of doing this? And if yes, can this kind of code be a part of the documentation?