Search code examples
spring-bootactivemq-classicactivemq-artemis

Migrating to Spring Boot 3 with ActiveMQ Classic


I am trying to migrate to Spring Boot 3 with the new namespace jakarta instead of javax, but the ActiveMQ Classic client has not been updated and was deprecated. Is there a way to continue using the old ActiveMQ client?

I tried the new ActiveMQ Artemis client but it seems like they are not interoperable with the ActiveMQ Classic server. Including the old ActiveMQ client results in not being able to use JMSTemplate for configuration because JMSTemplate uses jakarta.xx and expects a ConnectionFactory from jakarta.xx not javax.xx

Edit: Didn't work so the only way is to upgrade to ActiveMQ Artemis. That way the codebase is also nearly unchanged.

Edit: April 2023: The new ActiveMQ Client was released. You only need to swap the spring-boot-starter-activemq with the updated version and include this


Solution

  • Jakarta JMS compatible version ActiveMQ 5.18.x has been released. I was able to get this version working with no Spring 5.3.x dependencies:

    Removed

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-activemq</artifactId>
    </dependency>
    

    and included the broker with the new "jakarta client" dependency:

    <!-- 5.18 brings initial JMS 2.0 (javax.jms API) and Jakarta Messaging 3.1 (jakarta.jms API) client support -->
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-broker</artifactId>
        <version>5.18.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-client</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-client-jakarta</artifactId>
        <version>5.18.1</version>
    </dependency>
    

    We are now again able to send and receive messages with the (not yet migrated) unchanged ActiveMQ installation on our servers - parallel with a Spring Boot 2.7.x application and a 3.0.5 Spring application.