Why use RabbitMQ?
- Serves as a good messaging backend to
do PUB/SUB etc in our middleware
- Very robust
- Can be configured to use persistent messages
- Easy to use
- Has bindings for every major language
- Open Source
- Lots of plugins
- Widely used
- Good documentation
- Lots of tutorials
Usage
- Install the backend on a server
- Connect to it using your language of choice
- Define exchanges and their policies directly in code
- Send messages
Common Usage Patterns
Simple Messaging
Simply used to decouple components
A producer P produces messages,
while the consumer C consumes then
At-most-once semantics with persistent queues
At-least-once semantics if acknowledgements are used
Work Queues
Multiple consumers sharing workloads,
typically in a round-robin fashion
Messages can either be prefetched by workers
or delivered whenever a worker is available
or delivered whenever a worker is available
Pub/Sub
Here the exchange X handles message delivery
As in the typical case, fanout delivery is used
Queues are generated for consumers, where their
relevant messages will then be sent
relevant messages will then be sent
Routing
(Pub/sub + topics)
If multiple consumers listen to the same topic
then fanout-delivery is used
then fanout-delivery is used
Hierarchical topics can also be used:
fridge.context.*
*.*.error
meetingroom.projector
meetingroom.*
RPC (Req/Rep)
Requests and replies are matched using correlation IDs
The client also specifies where the server should send the reply
Summary
- Provides robust messaging
- Lots of usage patterns
- All language bindings we would want
- Expansion opportunities
Questions?
Copy of RabbitMQ
By Eder Rafo Jose Pariona Espiñal
Copy of RabbitMQ
- 617