I want to develop a SaaS chat that users will be able to embed on their website and also there will be a desktop chat client. Something similar to Live Chat. The problem is that I've never developed server or database programs. Also I'm new to Java but have some experience in desktop C# programming (developed some gui apps). In fact, I'm a student and don't have that much experience.
I'm trying to design a good scalable architecture for our server but after a few days of googling and reading wikipedia I feel overwhelmed with such amount of information. Server needs to be simple since it does not contain any presentation code but it has to be very fast because I'm expecting high traffic if service becomes popular. For now I've choosed most of technologies I'll be using. Here's my version of server architecture:
Now the biggest question is how to design this big 'Jetty' piece that contains business logic. I've already learned that I need to use MVP pattern. But there's still some major problems:
DatabaseManager
class that can load and save objects to database? Or make special static SaveToDb
and LoadFromDb
methods on classes? I think there must be an already developed framework for such things (it must be very common task for servers)NewMessage
event since most clients are in database, not in memory.Message
, User
and Chat room
. Where message is sent from user to chat room and chat room is a collection of subscribed users. This will be kind of answer to previous two questions.It will be very nice if you point me at appropriate technologies or design patterns.
What you're missing is the concept of the ORM (Object Relational Mapper). Look up what an ORM is, and how it can help you solve your problem of business logic within your Jetty layer. As mentioned in the comments, Hibernate is a great ORM; there are many ORMs out there. Do some research on what an ORM can do for you; it's the part of the puzzle you're missing, I believe.