RabbitMQ
AMQP messaging solution ideal for IoT and client/server use cases
Overview
RabbitMQ is lightweight and easy to deploy messaging platform. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet high-scale, high-availability requirements. Joule provides the ability to consume events using RabbitMQ messaging subscription
Client library: com.rabbitmq:amqp-client:5.16.0
Example
This example configures a RabbitMQ consumer to receive three event types using the routing keys
elements from the topic
exchange type. Quote events are deserialised from a StreamEvent Json object to a Joule StreamEvent object.
Attributes schema
Exchange Attributes
Exchange example
Routing Attributes
Routing example
This example will subscribe to all events that match the first component of the key 'NASDAQ'
Further examples
All examples assume default values when not applied.
Queue based eventing
Sets up a simple consumer which subscribes to events directly off of a queue.
Work Queues
Subscribe to a Worker Queue that is used to distribute time-consuming tasks among multiple Joule workers.
Publish/Subscribe
This example each consumer process will receive the same message. Because the exchange is configured as a fanout
we do not need to use the routing
element, this will be covered in the next example
Routing
This time we're going to make it possible to subscribe only to a subset of the messages for a single consumer. Therefore each Joule consumer process will have its own routing keys
they would subscribe to. In the case below a process using this configuration will only receive IBM and MSFT quotes.
Topic
This example is very similar to the previous case whereby we subscribe to events that we are interested in. However, we are using a topic exchange that enabled us to use the dot notation and wildcards to subscribe to a wider set of events. In the case below we would receive all market venue quotes for both IBM and MSFT.
Additional Resources
Further AMQP resources can be found on the following links:
Official RabbitMQ documentation
CloudAMQP documentation
Last updated