aspose file tools*
The moose likes Beginning Java and the fly likes Looking for open source message queue implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Looking for open source message queue implementation" Watch "Looking for open source message queue implementation" New topic
Author

Looking for open source message queue implementation

George Lin
Ranch Hand

Joined: Jan 11, 2005
Posts: 125
Hello everyone,


I am looking for open source message queue implementation in Java. Does anyone know where can I find a 100% pure Java implementation of message queue with basic features? It is better an implementation which does not rely on other components and can be used as a utility class.


Thanks in advance,
George
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Open JMS


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
George Lin
Ranch Hand

Joined: Jan 11, 2005
Posts: 125
Thanks Nathaniel,


Originally posted by Nathaniel Stoddard:
Open JMS


The project you recommended is very helpful. I simply want a local message queue and I want to queue some requests from user interface, and process them from the queue with priority. I also want to register/unregister message sender/receivers dynamically.

I have found out that the "OpenJMS" project you recommended is a JDBC and JMS based technology. My requirement is very simple and I do not want the message queue to be relied on any type of servers or databases. I want it to be used as a utility class. I think you are an expert of this field. Could you help?


regards,
George
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
If you're using JDK 1.5, you could use the java.util.PriorityQueue class to implement this quite easily. If you're not, you could simply use a TreeSet to keep the things in order for you automagically.


James Carman, President<br />Carman Consulting, Inc.
George Lin
Ranch Hand

Joined: Jan 11, 2005
Posts: 125
Thanks James,


Originally posted by James Carman:
If you're using JDK 1.5, you could use the java.util.PriorityQueue class to implement this quite easily. If you're not, you could simply use a TreeSet to keep the things in order for you automagically.


Your reply is very helpful. I am using JDK 1.3 and I think I can use the TreeSet approach as you recommended. I am not quite familiar with TreeSet. Could you recommend me some online resources dealing with how to use TreeSet in a correct and efficient approach?

I am also very interested in the internal implementation of the TreeSet datastructure. Can you recommend some related materials dealing with its internal datastructure implementation and operations?


regards,
George
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
No problem, George. Check out my post in another forum which includes code for my TtlReference class. This class uses TreeSet and might be a good example. Notice that I made sure the objects I was placing in the tree set implemented Comparable, but you can just as easily supply a Comparator object to the TreeSet when you instantiate it. It's not really that difficult to use TreeSet. You just add your objects to it and the set orders itself. The "lowest" object (by sort order) is the "first" object in the set. The key is appropriately ordering the objects. You are going to have a priority property, it seems, so that part should be easy. If you're going to have multiple listener threads, you will need to do some synchronization and probably using wait()/notify() like I did.

TreeSet is backed by a TreeMap, which uses a Red-Black tree to keep track of the keys. If you Google for Red-Black tree, I'm sure you'll find some information. If not, almost every data structures and algorithms book out there has a section on Red-Black trees.
George Lin
Ranch Hand

Joined: Jan 11, 2005
Posts: 125
Thanks James,


Originally posted by James Carman:
No problem, George. Check out my post in another forum which includes code for my TtlReference class. This class uses TreeSet and might be a good example. Notice that I made sure the objects I was placing in the tree set implemented Comparable, but you can just as easily supply a Comparator object to the TreeSet when you instantiate it. It's not really that difficult to use TreeSet. You just add your objects to it and the set orders itself. The "lowest" object (by sort order) is the "first" object in the set. The key is appropriately ordering the objects. You are going to have a priority property, it seems, so that part should be easy. If you're going to have multiple listener threads, you will need to do some synchronization and probably using wait()/notify() like I did.

TreeSet is backed by a TreeMap, which uses a Red-Black tree to keep track of the keys. If you Google for Red-Black tree, I'm sure you'll find some information. If not, almost every data structures and algorithms book out there has a section on Red-Black trees.


Your reply is very helpful and great!


regards,
George
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Looking for open source message queue implementation