The Artima Developer Community
Sponsored Link

Java Buzz Forum
Hazelcast 1.4: Distributed Events and more

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Talip Ozturk

Posts: 103
Nickname: talip
Registered: May, 2003

Talip Ozturk is founder of Hazelcast, distributed queue, set, map and lock implementation.
Hazelcast 1.4: Distributed Events and more Posted: Oct 30, 2008 4:38 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Talip Ozturk.
Original Post: Hazelcast 1.4: Distributed Events and more
Feed Title: Shared Memory
Feed URL: http://www.jroller.com/talipozturk/feed/entries/rss
Feed Description: about java, jcache, jini, javaspaces, distributed data structures and a little bit of me and life.
Latest Java Buzz Posts
Latest Java Buzz Posts by Talip Ozturk
Latest Posts From Shared Memory

Advertisement
For the new readers of this blog, Hazelcast is a distributed/partitioned queue, map, set, list, lock and executorservice implementation for Java. 1.4 release focuses on distributed events and messaging.

What is new:

  • Add, remove and update events for queue, map, set and list
  • Distributed Topic for pub/sub messaging
  • Integration with J2EE transactions via JCA complaint resource adapter
  • ExecutionCallback interface for distributed tasks
  • Cluster-wide unique id generator

Hazelcast documentation covers all these new features already but I would like to introduce you the Distributed Topic here in this entry. No configuration is needed to run the following code. Just download the zip, add the hazelcast.jar into your project, and run the following code on 5 JVM instances. You have cluster of 5 JVMs for pub/sub messaging! No config, no nothing...

import com.hazelcast.core.Topic;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.MessageListener;

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);
	} 
}

I hope the new Topic is simple and functional enough. Remember that topic operations are cluster-wide. If you add a MessageListener from member M, you will receive all messages published by any member in the cluster, including the new members joined after you added the listener.

Listeners will process the events/messages in the order they are actually fired/published. If event A occurred before event B on cluster member M, then it is guaranteed that all of the listeners of these events in the cluster will process event A before B.

Documentation at hazelcast.com covers all these new stuff with code samples so please visit the site for details.

What is next? Extending the Queue implementation to java.util.concurrent.BlockingQueue and some other cool stuff. Complete list of planned features can be found here. Got interesting feature in mind, let me know (oztalip at gmail dot com).

Read: Hazelcast 1.4: Distributed Events and more

Topic: Vancouver's 3rd Groovy/Grails Meetup - Wed. Nov/12th @ 7pm - Waves Coffee (Hastings/Richards) Previous Topic   Next Topic Topic: Fedora 10 - A Detailed Discussion on 13 Prime Features

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use