This project illustrates how you can use Artemis JMS with Quarkus.
First you need an Apache ActiveMQ Artemis server. You can follow the instructions from the Apache Artemis web site or run via docker using the ArtemisCloud container image:
docker run -it --rm -p 8161:8161 -p 61616:61616 -p 5672:5672 -e AMQ_USER=quarkus -e AMQ_PASSWORD=quarkus quay.io/artemiscloud/activemq-artemis-broker:0.1.4
The application can be started using:
mvn quarkus:dev
Then, open your browser to http://localhost:8080/prices.html
, and you should see a button to fetch the last price.
In addition to the prices.html
page, the application is composed by 3 components:
PriceProducer
- thePriceProducer
sends random prices to a JMS queue.PriceConsumer
- thePriceConsumer
receives the JMS message and stores the last price.PriceResource
- thePriceResource
is able to sent the last price of the PriceConsumer back to the browser.
The configuration is located in the application configuration.
You can compile the application into a native binary using:
mvn clean install -Pnative
and run with:
./target/jms-quickstart-1.0.0-SNAPSHOT-runner