This post is to continue the first part of the same topic. It mainly covers:
- Use commercial database as the data store
- Use the embedded Tomcat to manage the data source connection pool
Despite the fact that the ActiveMQ buildin Kaha database is more efficient when handling messages, we sometimes need to take other consideration too. For example, if your production environment prefers to database based backup and disaster recovery than NAS, you have to consider database.
Use MS-SQL-Server as the data store
There are many ways to create a datasource for ActiveMQ. This post creates one with SpringBoot and pass it to Tomcat for pool management.
Step#1: Add dependency spring-boot-starter-jdbc into the build file, and then add the following section into the application.properties file
Step#2: Disable broker auto-start. You need to ensure the broker is started after the data source is injected. This is done by calling
in the SpringBoot main() method, and then explicitly start it after setting the persistent adapter for the broker:
Use Tomcat to manage the connection pool
This can be easily done by adding the following into application.properties file
#Tomcat connection pool
The source code can be viewed or downloaded from here.
You may see build error due to missing mssql jdbc driver. You need to specify your repository that hosts the driver artifact, or put it into your local gradle cache.
You can find the next related post here.