views:

1331

answers:

8

I'm looking for a reasonably fast event handling mechanism in Java to generate and handle events across different JVMs running on different hosts.

For event handling across multiple threads in a single JVM, I found some good candidates like Jetlang. But in my search for a distributed equivalent , I couldn't find anything that was lightweight enough to offer good performance.

Does anyone know of any implementations that fit the bill?

Edit: Putting numbers to indicate performance is a bit difficult. But for example, if you implement a heartbeating mechanism using events and the heartbeat interval is 5 seconds, the heartbeat receiver should receive a sent heartbeat within say a second or two.

Generally, a lightweight implementation gives good performance. A event handling mechanism involving a web server or any kind of centralized hub requiring powerful hardware (definitely not lightweight) to give good performance is not what I'm looking for.

+1  A: 

when you say
a) lighweight
b) good performance,

can you put some numbers so that we can offer what we know of ?

anjanb
Vote for this again, without these sort of numbers you can't make the best choice IMHO.
Peter Lawrey
+2  A: 

AMQP(Advanced Message Queuing Protocol ) -- more details : http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol is probably what you're looking for.

It is used by financial service companies for their high performance requirements -- apache has an implementation going -- http://cwiki.apache.org/qpid/

OpenAMQ - http://www.openamq.org/ is an older REFERENCE IMPLEMENTATION .

anjanb
+2  A: 

Depending on your use case, Terracotta may be an excellent choice.

Alex Miller
+1  A: 

Whichever tool you use I'd recommend hiding the middleware APIs from your application logic. For example if you used the Apache Camel approach to hiding middleware you could then easily switch from AMQP to SEDA to JMS to ActiveMQ to JavaSpaces to your own custom MINA transport based on your exact requirements.

If you want to use a message broker I'd recommend using Apache ActiveMQ which is the most popular and powerful open source message broker with the largest most active community behind it both inside Apache and outside it.

James Strachan
A: 

If a JMS implementation isn't for you, then you may be interested in an XMPP approach. There are multiple implementations, and also have a Publish-Subscribe extension.

jamesh
+2  A: 

Hazelcast Topic is a distributed pub-sub messaging solution.

public class Sample implements MessageListener {

    public static void main(String[] args) { 
     Sample sample = new Sample();
     Topic topic = Hazelcast.getTopic ("default");  
     topic.addMessageListener(sample);   
     topic.publish ("my-message-object");
    }  

    public void onMessage(Object msg) {
     System.out.println("Message received = " + msg);
    } 
}

Hazelcast also supports events on distributed queue, map, set, list. All events are ordered too.

Regards,

-talip

http://www.hazelcast.com

+2  A: 

For distributed Event processing you could use Esper.It could process up to 500 000 event/s on a dual CPU 2GHz Intel based hardware.It's very stable because many banks use this solution. It supports JMS input and output adapter based on Spring JMS templates. So you could use any JMS implementation for event processing, i.e. ActiveMQ.

Pavel Rodionov
A: 

The Avis event router might be suitable for your needs. It's fast enough for near-real-time event delivery, such as sending mouse events for remote mouse control (an application we use it for daily).

Avis is also being used for chat, virtual presence, and smart room automation where typically 10-20 computers are communicating over an Avis-based messaging bus. Its commercial cousin (Mantara Elvin) is used for high-volume commercial trade event processing.

Matthew Phillips