In my project I have Business Logic implemented as EJB on Application Server and a desktop client - standalone application that calls those EJBs. Everything works fine when I have only one sided communication (client -> server) but now I need the possibility to subscribe / be pooled by server. So basically after client login into the server the server can send the update to it anytime. Since I cannot use EJB outside the Application server the question is how to do it (what's the standard and preffered way to solve such problems). Maybe I could any JMS implementation ?(how does it work outs开发者_C百科ide application server..)
Regards
Polling would be a simple solution. It may not fit your needs in all situations as it increases load on the server:
- Simply create an EJB on the server your desktop client can query to obtain any updates. For this you could create a background thread on the client. Using some kind of observer pattern on the client you're able to 'push' the information to the GUI.
JMS implementation seems appropriate here, the server publishes the message & client consumes it. Also as the communication will be asynchronous, it will utilize the client & server resources optimally.
Polling may reduce performance, as in many situations it may not be needed as a continuous activity. You can use topic/queue mechanism based on the requirements through synchronous/asynchronous communication.
精彩评论