We have EJBJSF application. I need to create a scheduler like a cron job, where the application will generate a report based on what customer defined(saved in database). For example, customer define to generate a report every 3pm. Or a customer can define to generate a report for them every Friday 7am.
Any idea on How can I implent this? given that we use EJB JSF running in JBOSS 7.
There are several options to do this. The simplest option will be to write a standalone java program that keeps running 24/7. This will check and if time matches will generate the report.
You can also use schedulers like Quartz to do this.
You can use EJB timers too, but that will be complex and probably overkill for this...
If you want to use EJB timers you need to have your application running(EJB requires a container available in App server). The other option would be(In case if you dont have any EJB calls in between)
1) you could use Quartz as Ranganathan mentioned in the post.
2)Have a standalone file using JDK timers which will triggers at a particular time
3)In case of unix machine, configure a cronjob calling a shell script file and this file would have the java call (java FetchReport).