Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>If your frequency is not that high (1min), polling from a browser in a database is OK, especially if you already have a database in your application, a job scheduler like Quartz, and you are using "only" a servlet container.</li> <li>If response times are important, consider using asynchronous servlets. Again on the server side, one thread can poll a database, and handle multiple clients efficiently.</li> </ul> <p>As for JMS</p> <ul> <li>As an alternative replace the database and the scheduler with JMS queues and message driven beans (MDB). The main difference is the programming model: Instead of <strong>polling</strong>, your receivers <strong>listen</strong>: They <em>get</em> notified. This way the framework can choose the best method to implement message delivery. In addition to a standard servlet container you now need a JMS provider, and possibly an EJB container.</li> <li>You can combine this with asynchronous servlets as well.</li> </ul> <p>If you do not use a database in the first approach: JMS supports persistent messages out-of-the-box, and the queues decouple client and worker by buffering the messages. This simplifies system maintenance: You can update the application with the workers without interrupting the clients.</p> <p><em>Update</em></p> <p>Message sender and receiver are decoupled by the message (it's asynchronous). So processing in the receiver is not stopped by any action in the user interface.</p> <p>For example</p> <ol> <li>The servlet sends a message. It returns immediately a HTML response to the user/browser: "Task has been submitted". It's asynchronous, because it does not wait for the result.</li> <li>The receiver gets the message, and starts processing, for example an MDB in its <code>onMessage</code> method</li> <li>The HTML page is refreshed: The servlet now checks, if there is a message in the response queue. There is none so far, so it returns "not yet completed".</li> <li>The receiver has finished its calculations, and puts the result as a message on the result queue.</li> <li>The HTML page is refreshed: Now there is a message, and it will present the results to the user.</li> </ol> <p>If you implement the checking as an AJAX call, the user does not see that you are actually polling.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload