Answer the question
In order to leave comments, you need to log in
How to properly plan the architecture for a Java EE application?
Please tell me the best way to implement. There is a Java application consisting of three parts: ejb itself with business logic, restful and standalone client
javascript clients periodically access the restful service, informing the owl of the state (something like a counter), it passes this data to ejb which logs it all to the database. Standalone client must promptly receive all messages from javascript clients. The question is how to actually implement it. If you constantly make calls to the rest so that it gives new events, there will be a lot of traffic. If you do a SOAP service - even more. What are the options?
Answer the question
In order to leave comments, you need to log in
the whole question is how to effectively make notifications from the service to the standalone client?
Poll http and that's it, no?
in the sense the client clings to "get /something/give_me_all_news"
with a pre-known timeout (1.5 minutes for example) the
service, if there is news - immediately reports
if there is no news - puts the request into the pool, remembering the start time of the request - and either the news appears - then immediately gives , or they don't appear - and it returns 204 but the content, after which the client immediately resends the same request ... extra traffic - minuscule, delay - funny
or about another question?
Well, I don’t know, I would take Grails and Swagger - I didn’t bother with bins.
Regarding traffic: if gzip is supported, large volumes are not a problem.
If you need to process more than 60-80MB of traffic, then the issue is solved in a completely different way.
It is also important to remember about async in servlets...
Actually, if you need to notify the client about the occurrence of events, then Websockets
and SSE will help here. You can look at Atmosphere and socket.io. XML or JSON is what is more convenient for you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question