Note that there are some explanatory texts on larger screens.

plurals
  1. POJ2EE - implementing constantly running component/daemon
    text
    copied!<p>I am designing a server application, that is supposed to crunch a lot of data continuously and present results on demand using web interface. </p> <p>The operating scheme goes roughly like this:</p> <ol> <li>An electronic sensor array constantly spills data into ramdisk through USB</li> <li>A "flusher" application processes data as fast as it can and loads it into db (staging area)</li> <li>Using triggers, db performs calculations on data and stores results in another schema (data area)</li> <li>Client webapp can display processed data in graphs/reports etc. on demand</li> </ol> <p>The solution would ideally look like this:</p> <ol> <li>Database server - PostgreSQL</li> <li>Have an administration web interface, that can monitor the flusher (i.e. records processed per hour or something like that) and if implemented as separate daemon, control it.</li> <li>Flusher and Client applications written in Java, ideally using J2EE</li> </ol> <p>Now the problem that keeps bugging me and I can't find the answer: How to go about writing the flusher component, i.e. a process that constantly runs in background in J2EE.</p> <p>By scouring the web, basically three possibilities emerged:</p> <p>a) Write the flusher as message driven bean and control it from master application using JMS. However: I don't like the idea of having a MDB running constantly, I'm not even sure that that's possible</p> <p>b) Write the flusher as EJB and control it using Timer/Scheduling service. However: the events are not really timed, it just needs to run in infinite loop until told not to do so, just seems wrong usage of the technology.</p> <p>c) Write the flusher as separate java application, run it as OS service (Linux or Windows) and control using startup scripts through ProcessBuilder invoked from EJB. To monitor it's status, use JMS. However: this just seems to me as overly complicated solution, platform dependent and maybe even unreliable and as EJB should not spawn/manage it's own threads, which ProcessBuilder basically does, it just seem wrong.</p> <p>Basically, none of these look right to me and I cannot figure out, what would we the right solution in the Java/J2EE world.</p> <p>Thank you Thomas</p>
 

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