I have a question. I have web app (written in struts, app buisness logic is in EJB) and I want it (www) to cyclic invoke some service method from EJB in defined period of time. Now I have service jsp page with "meta http-equiv="Refresh" and the method is invoked in struts Action. This is not good for me because it requires "user-admin" interaction with the page. I need solution transparent to the user. I consider servlet with some timer but now I see it is not good ide at all. Is there some good and simple solution for my problem. This should be something in shape of little deamon running in background on www server as a part of app and with ability of reading 2 parametrs from setup.properties: interval of invoking service method and on/off param.
Despite my previous hunch that servlet with timer is bad idea, this solution accoured to be working just fine. Short description what I have done to solve my specific problem (as I mentioned before it had to be simple):
- new servlet with <load-on-startup>1</load-on-startup> set in web.xml (app server runs it when app starts - this is what i needed)
- parameters from setup.properties are being read in servlet (in method invoked from init)
- using quartz library a job is being created and initialized with parameters (added 2 new classes: Job and scheduler )
- EJB facade service method is being invoked from job class
Works fine, transparent to the user, does not disturb in normal using the application. Mission accomplished.
Krum thank You for reply, it helped me to verify my solution.