-
I need to schedule some a job for a particular schedule and I need to pass some context information to job so that in execution it can get that data and do things as per the context. Now is there any way to pass the information like this in quarkus scheduler programmatic API. I am right now choosing which scheduler to go for and because my requirements are simple I would like to go with quarkus scheduler plus I also need native image building capabilities of quarkus for graalvm. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
/cc @mkouba (scheduler) |
Beta Was this translation helpful? Give feedback.
-
Where does the information come from? Is it known at the time the job is registered? Can't you just use a final/effectively final reference in the task |
Beta Was this translation helpful? Give feedback.
-
The information comes from db a set of jobs what query needs to be run and whom to send the report. The final reference I will try if there no options provided by the framework because then I need to define all the jobs as an anonymous callback. Which would look really dirty code. |
Beta Was this translation helpful? Give feedback.
You don't need to use an anonymous class/lambda. Just declare a separate class that implements
Consumer
/Function
and stores the information in a final field. Then simply instantiate this class and use it as a job task.