Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a background thread vs. using a message queue

I'm currently working on a series of alerts that will examine the status of a response from a foreign web service and send alerts based on the status of the the response object (for example timeouts, invalid data etc.). I want the main thread to continue working while the response is evaluated and alerts are sent.

I have two immediate options available to me:

  1. Use ActiveMQ and send the object as an objectMessage to the queue for processing.
  2. Use a command pattern and thread an asynchronous command that handles the alert.

They both seem like pretty good options to me but I'm leaning toward the threaded command since I don't need most of the features of a message queue.

Question: How would you decide which to use and why?

like image 915
Dave Maple Avatar asked May 18 '11 00:05

Dave Maple


1 Answers

Two words:

Guaranteed Delivery.

If thats important to you, then a message queue is what you want.

like image 177
Tim Jarvis Avatar answered Sep 20 '22 13:09

Tim Jarvis