wood burning stoves
The moose likes Distributed Java and the fly likes Java Messaging service vs. RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Java Messaging service vs. RMI" Watch "Java Messaging service vs. RMI" New topic

Java Messaging service vs. RMI

ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
As a new programmer I think I am getting confused.
I have already written a Java based instant messenger for the corporate environment. however I did this when I was rather junior to java.
I know see things that I could have and should have done better and would like to revisit my solution.
In doing so, I see that I could make some improvement on the server side of things.
How it worked before was that each person ran their own instance of the messenger, read a remote database but all messages were sent from the client machine to the others.
I would like to put a server piece on the same machine as the remote database but the problem then comes when I send a message to that server piece, it has to know what to do with it depending on the type of message sent.
I was thinking RMI would be the way to do this.
i.e. a broadcast message would call a SendBroadcastMesg on the server, a personal message would call SendPersonal...etc...
Is this a valid implementation of RMI?
Then I came across a book on JMS...would this be better?? Are JMS and RMI complimentary? I don't think I've followed from what I've read very well.
Any info you have would be greatly appreciated...

Ryan Headley<br /><a href="http://www.sudovi.com" target="_blank" rel="nofollow">http://www.sudovi.com</a>
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
JMS makes chat servers very easy. You can even run multiple chats on the same server simply by creating multiple topics to subscribe to.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
This really isn't a chat server, but probably close enough.
So do you think JMS would be worth looking into?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Absolutely - JMS offers nice control over topics, publish/subscribe versus point to point, etc.
Plus you get to learn a really significant kind of technology. Message Oriented Middleware (or MOM) is a big deal these days.
I found the book Java Message Service published by O'Reilly to be very useful when I was doing SOAP messaging with JMS.
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
Thanx for the info. I will be returning my RMI book in favor of of the JMS one. Would like to keep both, but can't at the moment.
One last question:
Everyone seemed to state this as if it were a web based technology, my app is actually stand alone java. Our machines are so fast nowawadays that we don't really notice much in the way of performance.
The big slow down is hitting the database. which I would prefer to let a server piece do, that my my client piece doesn't need to know any JDBC or anything.
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

What's the question, then?
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
Oh sheeesh silly me...
I think I just wanted clarificaton that its a good technology for stand alone java apps as well as internet/web based apps
I agree. Here's the link: http://aspose.com/file-tools
subject: Java Messaging service vs. RMI
jQuery in Action, 3rd edition