Dynamic OneTimeTask #520
Unanswered
valerobles
asked this question in
Q&A
Replies: 1 comment 2 replies
-
1.) 2.) 3.) No, you cannot change implementations (i.e. Tasks) after the scheduler has started. Implementations must be known at startup. If there are different code-paths, then use task-data to control what code-path runs. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using the db-scheduler library (not sb-scheduler for Spring Boot) in my Quarkus application. My goal is to have the service check for any pending or stuck tasks at startup. To achieve this, I create a Scheduler at startup like this:
However, I'm encountering an issue where, upon scheduling tasks dynamically at runtime, I receive the following error:
From what I understand, this error occurs because the scheduler created at startup is not aware of these dynamically created tasks. My tasks are defined using OneTimeTask, and their implementation varies based on different runtime inputs, making them dynamic.
My Questions:
Do I need to create a new Scheduler instance for each dynamically created task?
If so, how should I handle the scenario where I want to check for pending tasks at startup?
Is there a way to register these dynamic tasks with the scheduler at runtime so that it can recognize them and not raise the "unknown task-name" error?
What is the best practice for managing task implementations that vary based on input, particularly concerning checking for stuck or pending tasks at startup?
Any guidance or solutions for handling dynamic task scheduling and ensuring that all tasks are recognized by the scheduler, especially for recovery of pending tasks, would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions