Skip to content

ActiveMQ

Testcontainers module for ActiveMQ and Artemis.

ActiveMQContainer's usage examples

You can start an ActiveMQ Classic container instance from any Java application by using:

ActiveMQContainer activemq = new ActiveMQContainer("apache/activemq-classic:5.18.3")

With custom credentials:

ActiveMQContainer activemq = new ActiveMQContainer("apache/activemq-classic:5.18.3")
    .withUser("testcontainers")
    .withPassword("testcontainers")

ArtemisContainer's usage examples

You can start an ActiveMQ Artemis container instance from any Java application by using:

ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")

With custom credentials:

ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")
    .withUser("testcontainers")
    .withPassword("testcontainers")

With anonymous login:

ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")
    .withEnv("ANONYMOUS_LOGIN", "true")

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

testImplementation "org.testcontainers:activemq:1.20.4"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>activemq</artifactId>
    <version>1.20.4</version>
    <scope>test</scope>
</dependency>