I am building a software system, which is using Javascript to display an editable queue of server task (say program xyz is doing stuff on the server one task at a time).
- Browser UI (O-O JavaScript and JQuery)
- AJAX
- [missing technology in question]
- Linux PHP (Scripts that trigger the app to run)
Now the UI QUeue works great, but if someone closes their Browser, the state of the JavaScript Queue UI Application gets lost (all the tasks that the program on my linux box should peform)
So how to realise this? Would I need a Web application that is running as a service on my RedHat server communicating with the Object Oriented JavaScript App I wrote. The server tasks are already commandeered through PHP.
Is this possible with PHP? I want to avoid having a database at this time. A Java/Tomcat solution also springs to mind. What do you think? Thanks for reading this far.
You need to persist the queue state on the server at least to memory and preferably to disk too. To represent in memory create two classes
QueueandQueueEntrythe former being composed of the latter. If you only persist to memory you will lose queue state if the server process restarts – so write out to disk if you want to maintain state through a restart. Assuming Java, do the necessary to make those classes Serializable and write out to disk using a ReadWriteLock to avoid contention.Update to Reflect Using a DB
Instead of serialization, have a table of queue entries. Add a column to indicate order – most likely insert date.