Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looking for open source message queue implementation

 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open JMS
 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic