Question

I am trying to incorporate RabbitMQ based pub sub for a specific programming scenario,

I have a Web API endpoint. When I get a 201 response from this service I want to send out emails.

I already have another API endpoint which I can call to send out email.

Where do I setup the mailer?

And how do I setup RabbitMQ to handle this scenario? To clarify further, should this be a fanout exchange setup or not? And how are mails usually handled transient or persistent queues?

Was it helpful?

Solution

Sounds like a typical worker scenario where one side will queue up jobs/messages into a message queue (producer) and the other side will get the messages and process them (consumer/worker). In your case, the workers will get messages and send out an email (or hit your api endpoint that sends out emails). The workers typically run on separate machines so they can do work without affecting your application or api.

If you're using RabbitMQ, you should read the "Work Queues" tutorial to see how to set it up for your scenario: http://www.rabbitmq.com/tutorials/tutorial-two-python.html

There are some hosted solutions specifically for this too that don't require any setup like IronMQ for a message queue. Or even a step further if you don't want to deal with worker servers, you can use IronWorker.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top