Message Delivery Guarantees

Learn how distributed Elixir guarantees message delivery.

Good developers often associate certain words with particular pitfalls or techniques for avoiding them. Large dataset aggregation suggests the MapReduceMapReduce is a programming model and an associated implementation for processing and generating big data sets with a parallel, distributed algorithm on a cluster. pattern. Immutability may suggest functional languages. In this lesson, we’ll build another association. Whenever we consider events, we should also consider message delivery guarantees.

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 1200+ tech skills courses.