Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using azure servicebus to queue emails

we just moved some of our workloads to azure for which i am currently managing, i read a little about service bus and was wondering if i can use it to queue emails

applications hosted in azure though the use of a custom library will deliver their emails to a service bus queue where one or more worker processes will pick messages off the queue and send then though a mail relay service.

this will free my developers from the details of which mail relay service i am using at anytime and i can also perform further processing of the messages before sending without the developers changing their code.

my questions are, is this possible, if it is, is it advisable and is there anything i need to watch out for when implementing such a solution. any pointers on how to do it will also be appreciated

like image 401
araoko Avatar asked Mar 13 '23 22:03

araoko


1 Answers

Yes, it is a reasonable solution to add messages to an Azure Service Bus Queue that are later retrieved by an application that goes and send emails based on the details in the queued messages. This is a good way to decouple your various applications using a Microservices approach to providing an email sending service to be used either within the different pieces of a single app, or even across many apps within the organization.

One thing to watch out for is that the Message size in the Azure Service Bus Queue does have a maximum size limit. Depending on the length of the content being sent in the emails, you will need to store the details of the message somewhere, perhaps a database or Azure Table Storage. Then the message in the Queue would contain an identifier, such as a GUID, that could be used to look up the message details later when the receiving application processes it to send the email out. No matter the size of the massage in the queue, emails can get quite long, so using this approach is probably the best option for you so you wont have issues later with the implementation.

like image 195
Chris Pietschmann Avatar answered Mar 23 '23 22:03

Chris Pietschmann