Wiping out embedded activemq data during testing

activemq-classic, apache-camel, java, junit, unit-testing

Solution

just turn off broker persistence when you define the broker URL for your unit tests

vm://localhost?broker.persistent=false

Problem

I'm actively using `ActiveMQ` in my project. Although production use standalone `ActiveMQ` instance my tests require embedded `ActiveMQ` instance. After execution of particular test method `ActiveMQ` holds unprocessed messages in queues. I'd like to wipe out `ActiveMQ` instance after each test. I tried to use `JMX` to connect to local `ActiveMQ` instance and wipe out queues, but it's heavy-weight solution. Could anyone suggest me something more lightweight?

Original source