views:

161

answers:

3

My application requires events to be fired based on some specific activities that happen. I'm trying to determine if I should create my own event handling system using the Java EventObject with custom listeners similar to Java AWT Or should I use a JMS implementation? I was considering either apache's Qpid or ActiveMQ solution. I'm exploring these options at the moment and was wondering if anyone has experience with Qpid or ActiveMQ and can offer some advise (e.g., pros, cons to consider, etc) Also, if anyone has any suggestions for building a simple event handling system... if it's even worth while to consider this over a JMS based solution.

+1  A: 

You didn't say much about your application but if you need a simple event handling system for a single virtual machine, have a look at EventBus.

Pascal Thivent
+1  A: 

Simple event listeners (as used in Java AWT) require that events are handled immediately, within the same virtual machine, and typically within the same thread.

JMS (for instance using ActiveMQ) allows events to be handled at a later time (optionally buffering messages in persistent storage), and in other virtual machines / threads. That flexibility comes at the price of additional complexity and lower efficiency.

meriton
A: 

Do you want any yet-to-be-processed messages/events to be persisted in case your JVM instance dies? If so, you'll want an external message queue. Will any other applications ever need to publish / consume the same messages as this application? Same thing.

matt b