File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to build Messaging function in Swing Application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to build Messaging function in Swing Application?" Watch "How to build Messaging function in Swing Application?" New topic
Author

How to build Messaging function in Swing Application?

Yingie Pitts
Ranch Hand

Joined: Oct 10, 2002
Posts: 37
My swing application uses JDBC to access backend Oracle9i database. Different clients within the same intranet have seperate excutable in their local machine. I want to build a function that enables clients to send messages to each other. The messages should be like emails, i.e., they also can be CCed to multiple recipients, be saved in inbox and outbox etc. etc..All of the messages should also be saved into the database.
I am considering using Java API for XML Messaging or Socket technology. But I don't have experience of either of them. Do any of you have similar experience or have ideas of how to implement this messaging function on Swing applications? Any input would be highly appreciated.


"To err is human, but to really foul things up you need a computer." Paul Ehrlich.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Wow, why is e-mail not the answer? Do you have real-time requirements, like instant messaging?
Here are some things to think about building. You may or may not need them all.
clients register with server - I want to be a member of your club
clients log in to server - I'm available! Message me!
client displays address book all registered users
client displays current users logged on
user composes a message - to, from, subject, body, attachments
client saves a message draft to be sent later
client retrieves a draft, revises it
client sends a message to server
server pushes message to target clients now logged on
server stores message for target clients not logged on
client receives message pushed from server
client displays message, attachments
client stores message in local mailbox
client retrieves message from mailbox
client replies, forwards
client picks up stored messages from server
server pushes all stored messages after log in
This is a big job. Think about using e-mail again! About the only thing e-mail can't do is the "push" from server to client. How much is that worth?
[ September 30, 2003: Message edited by: Stan James ]
[ September 30, 2003: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
I want to build a function that enables clients to send messages to each other. The messages should be like emails, i.e., they also can be CCed to multiple recipients, be saved in inbox and outbox etc. etc..All of the messages should also be saved into the database.
Depending on what exactly you want to accomplish, there are several choices, of which the following two seem to fit your requirements better than the other:
Java Mail API
Java Message Service
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
actually, I did something similar to this.
Here is a basic idea:
1. A very simple basic server using sockets sitting on one of our server, it contains username and password and url for the database.
2. When client app is loaded, it asks the server for username, password and unique id to identify itself for the database.
3. server adds the user information into its user table (array, vector, however you like).
4. the client app does whatever it needs to do with the database.
5. When client needs to send a message, it queries the java server for a list of users, and send the message to server, and server publish the message to other users by matching unique ids.
this whole app took us about a week to write, rather simple and easy.
Of cource, you can make it extremely complicated if you like.
Yingie Pitts
Ranch Hand

Joined: Oct 10, 2002
Posts: 37
Thanks everyone.
But my users don't have email addresses, or at least they don't want to use emails. They want the message pops up on their machine when using the swing app. However it is not something like instant messenger because they don't chat with each other. The messages only be sent when certain event happen and either 1) the event trigers the message automatically, or 2) the owner of the event (user) draft a message himself.
Or, let's see if the socket solution works?
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Look at my solution, I think mine is the closest to your requirement.
Since that project doesn't use email neither. You can easily write a class to listen on your client app for messages, so you don't need to make direct connection from your client to client pc. Server should be listen on a queue, and push out message once an user creates a message.
Hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to build Messaging function in Swing Application?