Dynamically registering Jobs

Hi,

Is there a way at bootstrap to register the jobs in a Play 1 instance?

I know we can use several annotations (@On…) but we would like to register them on the run time.

Any guidance?

Thanks

Do you mean dynamically trigger them at startup?
You could have a bootstrap job that runs on application startup… and then kick off new jobs inside there?

@OnApplicationStart
public class Bootstrap extends Job {...}

but I’m not sure if this is what you mean?

Not trigger them at startup, but register them at startup. Something:

  • application starts and call Bootstrap Job
  • Bootstrap job reads a database that says this play server needs to run 3 jobs
  • on the job table, we find the cron job expression and job java class
  • we call some Play! API like "RegisterJob(MyCronJob, cronexpression) and then Play! will execute the job following the expression

It is the same as ‘hardcoding’ the @On on several jobs, but this time dinamically.

Thanks !