Overview
rabbit_mq
is an opinionated RabbitMQ client to help you build balanced and consistent Consumers and Producers.
The following modules are provided;
Balanced performance and reliability
The RabbitMQ modules are pre-configured with sensible defaults and follow design principles that improve and delicately balance both performance and reliability.
This has been possible through
- a) extensive experience of working with Elixir and RabbitMQ in production; and
- b) meticulous consultation of the below (and more) documents and guides.
⚠️ While most of the heavy-lifting is provided by the library itself, reading through the documents below before running any application in production is thoroughly recommended.
- Connections
- Channels
- Reliability Guide
- Publisher Confirms
- Consumer Acknowledgements and Publisher Confirms
- Consumer Acknowledgement Modes and Data Safety Considerations
- Consumer Prefetch
- Production Checklist
- RabbitMQ Best Practices
- RabbitMQ Best Practice for High Performance (High Throughput)
Performance
ℹ️ This section is currently being completed. Thank you for your understanding and patience.
- Talk about async mode for publisher confirms
- Talk about connection and channel pooling
- Talk about workers
Reliability
ℹ️ This section is currently being completed. Thank you for your understanding and patience.
- Talk about connection and channel pooling
- Talk about workers
Consistency
ℹ️ This section is currently being completed. Thank you for your understanding and patience.
The RabbitMQ modules are designed to help you build consistent, SDK-like Consumers and Producers.
defmodule CustomerProducer do
use RabbitMQ.Producer, exchange: "customer"
@doc """
Publishes an event routed via "customer.created".
"""
def customer_created(customer_id) do
opts = [
content_type: "application/json",
correlation_id: UUID.uuid4(),
mandatory: true
]
payload = Jason.encode!(%{version: "1.0.0", customer_id: customer_id})
publish(payload, "customer.created", opts)
end
@doc """
Publishes an event routed via "customer.created".
"""
def customer_updated(customer_data) do
opts = [
content_type: "application/json",
correlation_id: UUID.uuid4(),
mandatory: true
]
payload = Jason.encode!(%{version: "1.0.0", customer_data: customer_data})
publish(payload, "customer.created", opts)
end
end
Application design
ℹ️ This section is currently being completed. Thank you for your understanding and patience.
- Talk about connection and channel pooling and management, supervision, workers
- This is a near-0 dependency library, built solely on top of
amqp
.
Configuration
Please consult the Configuration guide for details.