A sample project to demonstrate the asynchronous communication between two spring boot apps producer and consumer through Apache ActiveMQ Artemis 2.4.0
Apache ActiveMQ Artemis is a combined feature-set of ActiveMQ/HornetQ/Apollo. It provides a non blocking architecture for an outstanding performance.
- Java 8
- Maven 3
- Spring Boot: 1.5.4.RELEASE
- Apache Artemis 2.4.0
In the Demo, we create 2 SpringBoot Artemis projects for producer/consumer:
Run Artemis
$ ${apache-artemis-home}\bin\artemis create ${apache-artemis-broker-dest}\broker1
$${apache-artemis-broker-dest}\broker1\bin\artemis run
Configure artemis queue Go to {apache-artemis-broker-dest}\broker1\etc\broker.xml
</addresses>
<!-- .... -->
<address name="demoQueue">
<anycast>
<queue name="demoQueue" />
</anycast>
</address>
</addresses>
Run the project
$ mvn clean package
$ java -jar .\target\artemis-consumer-0.1.0.jar
$ java -jar .\target\artemis-producer-0.1.0.jar
Test it
- Simple String Message
$ curl http://localhost:8080/produce?msg="Hello Artemis!"
- Pojo Object
$curl -X POST \
http://localhost:8080/produce -H 'content-type: application/json' -d '{"id":"1000", "name":"Hosni"}'
- Apache ActiveMQ Artemis https://activemq.apache.org/artemis/
- amazing Tutorial http://javasampleapproach.com/spring-framework/spring-jms/apache-artemis-produceconsume-jms-messages-springboot-artemis-applications
- Advanced Themes : http://nordlander.co/getting-started-with-apache-activemq-artemis/