Message Delivery Guarantees
Learn how distributed Elixir guarantees message delivery.
We'll cover the following
Good developers often associate certain words with particular pitfalls or techniques for avoiding them. Large dataset aggregation suggests the
At-most-once delivery
Consider a simple welcome email that we might want to send each time a user creates an account. We could do so asynchronously with the Task
module, but if the client fails or the server abruptly terminates, the email won’t be sent. Maybe we’re willing to live with the consequences. If the email contained the user confirmation token, they can always request a new one later. In such cases, we provide the at-most-once delivery. The email may or may not be sent.
Maybe it doesn’t seem like a good idea to drop the email, because losing it could impact adoption. This means a persistence mechanism is needed. If the node responsible for sending the email catches on fire, another node needs to pick this job up. Once persistence becomes part of the equation, don’t reinvent the wheel. Use a third-party solution designed for the problem, such as RabbitMQ.
Get hands-on with 1400+ tech skills courses.