2 ms·
I'm not sure that I fully understand why the author considers message queuing via something like ActiveMQ to be complicated or difficult. 1) Install ActiveMQ (
by mootothemax 14y ago
I'm not sure that I fully understand why the author considers message queuing via something like ActiveMQ to be complicated or difficult.
1) Install ActiveMQ (or my preferred option, ActiveMQ Apollo http://activemq.apache.org/apollo/ http://activemq.apache.org/apollo/).
2) Write an email script that subscribes to the message queue, and sends an email for each message received.
3) In the web app, publish a "send email" message to the message queue.
That's it - nothing more complicated required. Look at the number of libraries that use the Stomp protocol, and you can be up and running inside of a few minutes.
Spinning off a separate thread to perform this work is entirely sufficient and much simpler
I strongly disagree with this advice, if only because it's so incredibly easy to screw up from a security perspective. If you want to handle errors or other unexpected issues, doing so via spinning up background threads is going to lead you to a world of hacky pain.
One of the most inspiring articles I read about using queues is 5 subtle ways you’re using MySQL as a queue, and why it’ll bite you:
http://www.engineyard.com/blog/2011/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you/ http://www.engineyard.com/blog/2011/5-subtle-ways-youre-usin...
- mnbbrown 14y agoThe article you linked too is interesting because: "Storing a list of messages to send: whether it’s emails, SMS messages" seems to be something like reddit does [1] & [2]. Is this the case: [1] https://github.com/reddit/reddit/blob/master/r2/r2/lib/emailer.py https://github.com/reddit/reddit/blob/master/r2/r2/lib/email... [2] https://github.com/reddit/reddit/blob/master/r2/r2/models/mail_queue.py https://github.com/reddit/reddit/blob/master/r2/r2/models/ma...