views:

405

answers:

3

Tomorrow I am presenting my rationale for choosing an in-process message queue implementation, and I'm unable to articulate my reasoning. My co-designers are proposing that we implement a simple asynchronous queue using just a basic list of jobs and a mutex to control access, where I'm suggesting ActiveMQ in embedded mode. I've personally been very impressed by ActiveMQ, and I would like to have some good, solid arguments to back up my gut impression.

If it matters, the application is basically 1 producer/n consumers, with priority and type information specific to the individual jobs being processed.

It's worth noting that so far the manageability and extensibility of the solution have not been powerful arguments. I'd love it if someone could give my arguments more punch. Can the forum help me out with that?

+2  A: 

If manageability and extensibility are not high priorities then I have to wonder what your reasons are for wanting to use a manageable message queue? Maybe your colleagues are right, and you really don't need the extra feature set?

1800 INFORMATION
+2  A: 

Not having to debug concurrency code in weird edge cases is a big benefit. I don't know how important this structure is as part of your overall project, but if the message queue is a big part of your project, then you can reap tremendous benefits by using an implementation that someone else has written, already debugged, and will maintain for you. If it's just some one-off part of an unimportant subsystem, it probably doesn't matter what you end up doing. But if it's critical, I'd much rather file a bug report than spend my time debugging concurrency code (I'm already starting to recoil in fear!).

The short version: Don't let NIH syndrome stop you from using someone else's work to get your job done faster, better, and cheaper. But don't build a mountain out of a molehill, either.

kquinn
You make a good point, but you should keep in mind that you should not ever out source your main line of business. I think Joel explained it better on the podcast than I am, but to illustrate it he said how if you are id software, then you write your own 3D engine, but if you are writing a DOOM3 clone, then you use someone elses.Then, in this example, you have to decide if the message queue is your main thing, or a sideline - if you are writing an ESB then it probably is...
1800 INFORMATION
I don't agree with that line of reasoning. Yes, if you are id Software you can afford to write your own 3D engine. But in this day and age, with high-quality open-source code everywhere you look, it's entirely reasonable to grab some open-source code to *start* your project. Yes, if your product takes off, by all means you should have your own core code, either written from scratch or as a fork. But intelligent use of existing code can make or break a startup.
kquinn
+3  A: 

Your coworkers arguments are not without merit. Adding ActiveMQ to the project is adding yet another dependency. It will probably be more complicated to use, and it will have a greater footprint than a custom solution. Also, since you are adopting it, it is likely going to become your responsibility to maintain and keep working smoothly - bugs and all.

That said, ActiveMQ (and other queues) will do things that you could write yourself, but might prove to be a pain. Supporting the entire JMS API is one of them (though I am presuming you are using Java...if you are not, then this point is not valid). Serializing excess messages to disk in high memory situations is another. Durable subscribers and message selectors are a few other things that come to mind. Mostly bells-and-whistles sort of thing for your needs it seems, but they become very important for reliable message delivery.

Whatever you decide, encapsulate the final choice of message broker away from the client code to make it easier to switch.

Matt Green