Package io.quarkus.scheduler
Interface Scheduler
public interface Scheduler
The container provides a built-in bean with bean type
Scheduler and qualifier
Default.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe job definition is a builder-like API that can be used to define a job programmatically. -
Method Summary
Modifier and TypeMethodDescriptiongetScheduledJob(String identity) booleanIdentity must not be null andfalseis returned for non-existent identity.booleanbooleanBy default, the scheduler is not started unless aScheduledbusiness method is discovered.Creates a new job definition.voidpause()Pause the scheduler.voidPause a specific job.voidresume()Resume the scheduler.voidResume a specific job.unscheduleJob(String identity) Removes the job previously added vianewJob(String).
-
Method Details
-
isStarted
boolean isStarted()By default, the scheduler is not started unless aScheduledbusiness method is discovered. However, it is possible to set theforcedstart mode with thequarkus.scheduler.start-modeconfiguration property. In this case, the scheduler will be started even if no scheduled business methods are found.- Returns:
trueif the scheduler was started,falseotherwise
-
pause
void pause()Pause the scheduler. No triggers are fired when a scheduler is paused.- Throws:
UnsupportedOperationException- If the scheduler was not started
-
pause
Pause a specific job. Identity must not be null and non-existent identity results in no-op.- Parameters:
identity-- Throws:
UnsupportedOperationException- If the scheduler was not started- See Also:
-
resume
void resume()Resume the scheduler. Triggers can be fired again.- Throws:
UnsupportedOperationException- If the scheduler was not started
-
resume
Resume a specific job. Identity must not be null and non-existent identity results in no-op.- Parameters:
identity-- Throws:
UnsupportedOperationException- If the scheduler was not started- See Also:
-
isPaused
Identity must not be null andfalseis returned for non-existent identity.Note that this method only returns
trueif the job was explicitly paused. I.e. it does not reflect a paused scheduler.- Parameters:
identity-- Returns:
trueif the job with the given identity is paused,falseotherwise- Throws:
UnsupportedOperationException- If the scheduler was not started- See Also:
-
isRunning
boolean isRunning() -
getScheduledJobs
- Returns:
- an immutable list of scheduled jobs represented by their trigger
- Throws:
UnsupportedOperationException- If the scheduler was not started
-
getScheduledJob
- Returns:
- the trigger of a specific job or null for non-existent identity
- Throws:
UnsupportedOperationException- If the scheduler was not started
-
newJob
Creates a new job definition. The job is not scheduled until theScheduler.JobDefinition.schedule()method is called.The properties of the job definition have the same semantics as their equivalents in the
Scheduledannotation.- Parameters:
identity- The identity must be unique for the scheduler- Returns:
- a new job definition
- Throws:
UnsupportedOperationException- If the scheduler was not started- See Also:
-
unscheduleJob
Removes the job previously added vianewJob(String).It is a no-op if the identified job was not added programmatically.
- Parameters:
identity-- Returns:
- the trigger or
nullif no such job exists - Throws:
UnsupportedOperationException- If the scheduler was not started
-
implementation
String implementation()- Returns:
- the implementation
- See Also:
-