spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

Provide configuration properties for configuring an ActiveMQ connection factory that uses SSL

Open sh930108 opened this issue 6 years ago • 4 comments

Springboot has no place to configure SSL related parameters and certificates for Activemq,Springboot activemq supports SSL connections by default?

sh930108 avatar Jun 29 '19 06:06 sh930108

There's no property based support for configuring a connection factory that uses SSL with a custom keystore or custom truststore. You can, however, provide your own ActiveMQSslConnectionFactory bean and keep the rest of the auto-configuration.

wilkinsona avatar Jun 29 '19 19:06 wilkinsona

I've opened #17589 for us to consider more broadly how we should support SSL.

philwebb avatar Jul 19 '19 16:07 philwebb

We need to override the default connection to ActiveMQ using ActiveMQSslConnectionFactory bean with your own configuration properties :

@Bean
public ActiveMQSslConnectionFactory activeMQSslConnectionFactory(
        @Value("${spring.activemq.broker-url}") String brokerUrl,
        @Value("${spring.activemq.ssl.trustStorePath}") String trustStorePath,
        @Value("${spring.activemq.ssl.trustStorePass}") String trustStorePass,
        @Value("${spring.activemq.ssl.keyStorePath}") String keyStorePath,
        @Value("${spring.activemq.ssl.keyStorePass}") String keyStorePass) throws Exception {
    ActiveMQSslConnectionFactory factory = new ActiveMQSslConnectionFactory(brokerUrl);
    factory.setTrustStore(trustStorePath);
    factory.setTrustStorePassword(trustStorePass);
    factory.setKeyStore(keyStorePath);
    factory.setKeyStorePassword(keyStorePass);
    return factory;
}

SaadiMelek avatar Jan 27 '21 10:01 SaadiMelek

Blocked by #34011

scottfrederick avatar Mar 31 '23 19:03 scottfrederick