I am aware RabbitMQ is written in Erlang and thus can't be embedded in a JVM like we would do with the ActiveMQ JMS broker for exemple.
But actually there are some projects that are done in another language and that can easily be embedded for integration tests.
For exemple, MongoDB, written in C++, can be easily started/stopped in the context of a JVM integration test with: https://github.com/flapdoodle-oss/embedmongo.flapdoodle.de
There is also someone porting it to Java: https://github.com/thiloplanz/jmockmongo/
So I just wonder how can we do integration tests when my application is written in Java, and the other technology is in another langage (like Erlang for RabbitMQ)?
In general what are the good practices?
I see 3 main solutions:
- Starting a real RabbitMQ
- Embedding a JVM port of the technology in the currently used Langage
- Use standard technologies so that a technology in Erlang may have the same behavior and communication layer that another one in Java (RabbitMQ / Qpid / StormMQ implementing AMQP)
Is there a Maven/Sbt/Ant plugin to startup a temporary RabbitMQ broker? Any project to support Junit/TestNG RabbitMQ before a test class?
I have seen that there is an opensource implementation of AMQP in Java: Apache Qpid Has someone any experience using this implementation for integration testing while in production there is RabbitMQ? Is it even possible? I am using Spring Integration.
By the way, I just noticed that the Spring-AMQP project mention on its github readme:
Many of the "integration" tests here require a running RabbitMQ server - they will be skipped if the broker is not detected.