Email Microservice

CamiKaze

Honorary Master
Joined
May 19, 2010
Messages
14,537
Trying to find a good article on whether this is a good idea or not.
What do you guys think?

I'm thinking of having RabbitMQ or MQTT infront of a Microservice that deals with emailing people.
 

dadecoza

Expert Member
Joined
Aug 30, 2006
Messages
1,254
I have email, sms, and skype for business microservices as consumers on RabbitMQ works great.
 

CamiKaze

Honorary Master
Joined
May 19, 2010
Messages
14,537
Thanks man.
Anything you came across that was a roadblock?
 

dadecoza

Expert Member
Joined
Aug 30, 2006
Messages
1,254
Thanks man.
Anything you came across that was a roadblock?

It works pretty well and stable, but if for some reason the micorservice/consumer do fall over and it is down for some time and you restart it, it will just continue to process the messages on the queue. In most cases this is a good thing but if you are sending out time sensitive notifications like OTPs or 2FA requests then you might end up flooding users with expired messages. In some cases you would clear the queues before restarting the consumer.

(ideally you should have multiple consumers on the same queue to avoid the above situation)
 

CamiKaze

Honorary Master
Joined
May 19, 2010
Messages
14,537
Yo, @dadecoza ,

I am going to try another approach through Azure, using SendGrid.

Setting it up is a byatch though.
 

Nether

Expert Member
Joined
Jan 15, 2007
Messages
1,240
Got a Camel Apache fuse route looking at a Kafka message queue that routes to an internal smtp server. All on openshift, works great
 

dadecoza

Expert Member
Joined
Aug 30, 2006
Messages
1,254
Yo, @dadecoza ,

I am going to try another approach through Azure, using SendGrid.

Setting it up is a byatch though.

If you want to go cloud then you can also look at AWS SNS. It combines queues with notification services like email.
 

Hamster

Resident Rodent
Joined
Aug 22, 2006
Messages
39,138
Yo, @dadecoza ,

I am going to try another approach through Azure, using SendGrid.

Setting it up is a byatch though.

SendGrid's API goes down no and again (or becomes unreachable) and also VERY finicky wrt characters like é for example.

So:
  • You'll want to sanitise the data being sent especially people's names
  • You'll want to check those response statuses and persist the failed messages to a database.
  • The 4xx errors are done for and you'll want visibility on them to either be manually fixed or at least make sure future messages don't suffer the same error.
  • The 5xx errors you'll wan to try resend based on a timeframe that makes sense (does it make sense to retry for a couple of hours, days or never?)
If your going microservices and want a bus/broker in between then I'd use Nats.io for simplicity's sake. I wouldn't bother with Kafka, RabbitMQ or anything else really (unless your using cloud infrastructure like AWS SNS etc, obviously)
 
Top