Skip to content

Commit

Permalink
Update scheduler-reference.adoc
Browse files Browse the repository at this point in the history
fix #16942: Add example of pause/resume of specific identity
  • Loading branch information
adrianfiedler committed May 10, 2021
1 parent 4fc86c2 commit 85469af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/src/main/asciidoc/scheduler-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void nonConcurrent() {

== Scheduler

Quarkus provides a built-in bean of type `io.quarkus.scheduler.Scheduler` that can be injected and used to pause/resume the scheduler.
Quarkus provides a built-in bean of type `io.quarkus.scheduler.Scheduler` that can be injected and used to pause/resume the scheduler and individual scheduled methods identified by a specific `Scheduled#identity()`.

.Scheduler Injection Example
[source,java]
Expand All @@ -215,15 +215,19 @@ class MyService {
void ping() {
scheduler.pause(); <1>
scheduler.pause("myIdentity"); <2>
if (scheduler.isRunning()) {
throw new IllegalStateException("This should never happen!");
}
scheduler.resume(); <2>
scheduler.resume("myIdentity"); <3>
scheduler.resume(); <4>
}
}
----
<1> Pause all triggers.
<2> Resume the scheduler.
<2> Pause a specific scheduled method by its identity
<3> Resume a specific scheduled method by its identity
<4> Resume the scheduler.

== Programmatic Scheduling

Expand Down

0 comments on commit 85469af

Please sign in to comment.