ActiveMq – Explicitly configure Spring ActiveMq ConnectionFactory with SpringBoot
In the past tutorial, we had learned how to start a Spring JMS ActiveMQ application with auto-configured ConnectionFactory by SpringBoot.
But in the software development, there're many cases that we need to override the ContainerFactory, so How to do it? JavaSampleApproach makes the tutorial to guide how to explicitly configure Spring ActiveMQ ConnectionFactory.
Related posts:
- How to use Spring JMS with ActiveMQ – JMS Consumer and JMS Producer | Spring Boot
- How to start Spring Kafka Application with Spring Boot
- Spring Jms ActiveMq – How to send Java object messages to ActiveMQ server (specially with Bi-Directional relationship Java objects)
- ActiveMq – How to work with Spring JMS ActiveMq Topic (Publisher-Subcribers pattern) using SpringBoot
I. Technologies
– Java 8
– Maven 3.6.1
– Spring Tool Suite: Version 3.8.4.RELEASE
– Spring Boot: 1.5.4.RELEASE
- Apache ActiveMQ 5.13.0
II. Spring ActiveMq connection-factory
For configuring ActiveMQ ContainerFactory, we need to setup a new beanConnectionFactory
to override the auto-configured connection-factory bean of SpringBoot.
...
@Bean
public ConnectionFactory connectionFactory(){
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
...
return connectionFactory;
}
Then use the ConnectionFactory
bean to configure 2 beans {JmsListenerContainerFactory, JmsTemplate}:
More at:
ActiveMq – Explicitly configure Spring ActiveMq ConnectionFactory with SpringBoot
Top comments (0)