Currently I am exploring Quartz scheduler for one of our projects. While I am still in process of exploring it, I have a few doubts.
Earlier I was working with one of Java-based e-commerce platforms where they have implemented Quartz scheduler in a very good way. Defining a new task requires the following steps.
- Log in to the GUI.
- Click on new button, and it will open a page.
- Enter the unique
Jobname and the method name that we want to call. - Any parameters which we want to pass; if methods need them, only primitives are allowed.
- Provide trigger details (Time, Day, Month any possible combinations).
- Hit the save button and we are ready to go.
Now this prompted a few question, since in Quartz we have to create a job class that should implement Job interface and should implement its execute(JobExecutionContext context) method, which will perform the work. I am wondering how that API on the platform was doing all this, as I have never created a class which has to implement the Job interface.
For example, if i want to create a OrderExport function, all I did is created a class namely OrderExport with a method say export. Then in the UI for scheduler, I just filled the text-boxes with job name (any unique name), class name (e.g. OrderExport), method name (e.g. export()) and triggering details.
Can any one suggest/guide me how they have achieved this?
More likely than not, the ecommerce platform was using a generic job, that could get reference to the component (maybe it was factory based, it had ways to get access to your OrderExport class? was the method required to be static by any chance? Which ecommerce platform was this?) and execute the method requested via reflection.