This example was merged with the Apache Artemis project and won't receive more updates.
This is a small sample of how to send and consume messages using Spring JMS, QPID and JMS Pool to a Red Hat AMQ7 broker. Use it as a reference for your own implementation.
Behind the scenes this sample uses amqp-10-jms-spring-boot library to set up the code infrastructure and configuration. Please take a look at its documentation to fine tune this sample for your needs.
-
Edit the
src/main/resources/application.yml
file and add your broker credentials to it. -
Create the queue at your
broker.xml
file:
<addresses>
<address name="mailbox">
<anycast>
<queue name="mailbox">
<durable>true</durable>
</queue>
</anycast>
</address>
</addresses>
-
Run the application with
mvn spring-boot:run
. The server should start at8080
port and exposes/produce
endpoint: http://localhost:8080/produce -
Hit it and a message should be sent to
mailbox
queue.
You may also use the hawtio console to send messages directly to the queue using the following format:
{
"to":"test@test.com",
"body":"this is my body"
}