• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to build Messaging function in Swing Application?

 
Yingie Pitts
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic