Skip to content

Instantly share code, notes, and snippets.

Created October 7, 2015 21:37
Show Gist options
  • Save anonymous/246402cac90648b307e5 to your computer and use it in GitHub Desktop.
Save anonymous/246402cac90648b307e5 to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment