Demo using the Bootique RabbitMQ Module. Also demonstrates POJO -> JSON Message conversion with Jackson.
RabbitMQ Server must be running. It is assumed RabbitMQ guest/guest access is enabled. Depending on your RabbitMQ configuration you may have to create the following Exchanges and Queues, which may not be created automatically.
Create Queues listed in Bootique Module bootique.yaml
files:
Exchanges/Queues: bqMessages, bqReservations, rpcMessages, rpcReservations
Note: set durable property to TRUE. Also, any Exchanges created are type TOPIC.
There are two demo options:
- One-Way Send of String Message or Reservation Object. Server acknowledges receipt. Nothing returned to client.
- RabbitMQ RPC, A) sending a Reservation Object and returning a Message, B) sending a String Message and retrieving a Customer Object
To switch between demo options, comment the appropriate property found in the Common
Module /resources/common.properties
file.
startup.type=rpc
#startup.type=messages
To send a Reservation
Object wrap the string in {curly brackets} in the Sender application when prompted.
The demo app includes both SENDER and RECEIVER modules, both of which share a COMMON Module.
To Build with Maven:
$ mvn clean install
To send messages
$ java -jar send/target/mqsend.jar
To receive messages, in a 2nd Terminal Window use the following:
$ java -jar send/target/mqreceive.jar
- A Bootique RabbitMQ Demo Application
- Passing POJOs in RabbitMQ
- Rabbit RPC Demo with Bootique
- Returning an Java Object List in RabbitMQ RPC
Last Updated 02-26-2018