Hello. As a design work, I decided to write an instant messenger, but I can hardly imagine how they work and write at all. As I understand it, for each registered user a table is created in the database (SQL, for example), a server is started that is associated with this database, and during the work of the messenger each registered user accesses this database. So how do the two users interact? How is Apache applied? Please throw at least a link to the desired literature or article. Thank you in advance!
- The messenger is based on the interaction protocol, which describes the procedures for registering users, subscribing to services, the format of messages and much more. You immediately try to dig the implementation by jumping over the interaction logic. You can take one of the open standards . For example, XMPP or SIP. When you understand architecture and enrich yourself with terminology, you can think through implementation details. - enzo
1 answer
It depends on what the project is.
Just show what works with minimal effort? You can look in the direction of JMS.
A queue is made for each user. All activity is reduced to reading, writing messages from / to the queue.
With database intersection the most minimal. Only a list of users with their logins.
JMS has its own message base, which is managed by itself without outside intervention. Messages there if stored, only temporarily until successful delivery to the addressee.
JMS comes as part of the JavaEE Full Profile servers. Free Wildfly, Glassfish, Payara.
There are other solutions for messaging.
Very popular is RabbitMQ.
In Windows, you can immediately install Message Queuing. But I don’t know if there is a java client for it.
In general, this is all called message queuing . You can easily google manuals in pictures.
The truth is likely to amass hemorrhoids, introducing jms into the program. Just a couple of lines / parameters, but must be correct. And the information in Google is very inaccurate.
And we do not need Apache.