As SSL ActiveMQ is not currently supported for autoconfiguration (https://github.com/spring-projects/spring-boot/pull/17373, https://github.com/spring-projects/spring-boot/issues/17589), this helps provide a low-cost stop-gap measure for autoconfiguring with SSL. This could be used in a way similar to ActiveMQConnectionFactoryConfiguration's usage of ActiveMQConnectionFactoryFactory:
@Bean
public ActiveMQProperties properties() {
return new ActiveMQProperties();
}
@Bean
@ConfigurationProperties(prefix = "javax.net.ssl") //standard ssl prefix that also fits ActiveMQSslConnectionFactory method naming, allowing easy SSL property injection
public ActiveMqSslConnectionFactory connectionFactory(ActiveMQProperties properties,
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
new ActiveMQConnectionFactoryFactory(properties,
factoryCustomizers.orderedStream().collect(Collectors.toList()))
.createConnectionFactory(ActiveMQSslConnectionFactory.class);
}
Right now, with this class being package-private, wiring spring.active.x and spring.jms.x properties into an ActiveMQSslConnectionFactory is a bit of a hassle.
Comment From: wilkinsona
Thanks for the suggestion. I'm a little reluctant to increase the surface area of Spring Boot public API for something that should only be a stop-gap measure. It would commit us to longer-term maintenance and backwards compatibility that we'd rather avoid unless necessary.
ActiveMQConnectionFactoryFactory
isn't a particularly large class. You may be better copying that class into your application. Flagging for team attention to see what the rest of the core team thinks.
Comment From: snicoll
FTR, I am also not keen to increase the surface area of the public API, especially as we are going to revisit it to support SSL at some point. Having a non public API gives us the flexibility to change the signature any way we like.
Comment From: wilkinsona
We discussed this one today and agreed that we do not want to make ActiveMQConnectionFactoryFactory
public. Thanks anyway for the suggestion. Our recommendation is to copy its code into your application if it is useful to you to do so.