Making a Mailing Microservice with Elixir and RabbitMQ
Blog post from Semaphore
Rendered Text has developed a microservices architecture to create an efficient mailing system for their Semaphore product, utilizing Elixir, RabbitMQ, and Apache Thrift. This system decomposes tasks into smaller, independently functioning services, such as gathering data, processing it, and sending emails. They use RabbitMQ for asynchronous messaging, with a Ruby producer sending encoded messages to an Elixir consumer, and ex-tackle for message handling. The email composition leverages Elixir's EEx for HTML template rendering, allowing data to be inserted into HTML partials for better readability. For email delivery, the SparkPost API is employed, facilitating the sending of emails with analytics and support for multiple recipients. The entire process, from data gathering to email dispatch, is streamlined to take less than four seconds, with a preview email sent to service owners before customer reports are issued.