-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
277 additions
and
17 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
docs/modules/ROOT/examples/InMemorySchedulerLockService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.shedlock.providers.inmemory.runtime.InMemorySchedulerLock; | ||
|
||
@ApplicationScoped | ||
public class InMemorySchedulerLockService { | ||
@InMemorySchedulerLock | ||
public void runUsingLock() { | ||
// do something | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
docs/modules/ROOT/examples/InMemorySchedulerLockServiceOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.shedlock.common.runtime.LockDuration; | ||
import io.quarkiverse.shedlock.providers.inmemory.runtime.InMemorySchedulerLock; | ||
|
||
@ApplicationScoped | ||
public class InMemorySchedulerLockServiceOptions { | ||
@InMemorySchedulerLock(lockDuration = @LockDuration(lockAtMostFor = "PT30S", lockAtLeastFor = "PT10S")) | ||
public void runUsingLock() { | ||
// TODO do something | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.shedlock.providers.jdbc.runtime.JdbcSchedulerLock; | ||
|
||
@ApplicationScoped | ||
public class JdbcSchedulerLockService { | ||
@JdbcSchedulerLock | ||
public void runUsingLock() { | ||
// do something | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
docs/modules/ROOT/examples/JdbcSchedulerLockServiceOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.shedlock.common.runtime.LockDuration; | ||
import io.quarkiverse.shedlock.providers.jdbc.runtime.JdbcSchedulerLock; | ||
|
||
@ApplicationScoped | ||
public class JdbcSchedulerLockServiceOptions { | ||
@JdbcSchedulerLock(dataSourceName = "master", lockDuration = @LockDuration(lockAtMostFor = "PT30S", lockAtLeastFor = "PT10S")) | ||
public void runUsingLock() { | ||
// do something | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.shedlock.providers.mongo.runtime.MongoSchedulerLock; | ||
|
||
@ApplicationScoped | ||
public class MongoSchedulerLockService { | ||
@MongoSchedulerLock | ||
public void runUsingLock() { | ||
// do something | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
docs/modules/ROOT/examples/MongoSchedulerLockServiceOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.shedlock.common.runtime.LockDuration; | ||
import io.quarkiverse.shedlock.providers.mongo.runtime.MongoSchedulerLock; | ||
|
||
@ApplicationScoped | ||
public class MongoSchedulerLockServiceOptions { | ||
@MongoSchedulerLock(mongoClientName = "cluster1", lockDuration = @LockDuration(lockAtMostFor = "PT30S", lockAtLeastFor = "PT10S")) | ||
public void runUsingLock() { | ||
// do something | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
* xref:index.adoc[Getting started] | ||
TODO faire chaque page ou autres ... voir le service amazon | ||
mais je pense que je ne devrais pas l'utiliser ... | ||
* xref:shedlock-in-memory.adoc[Shedlock in memory provider] | ||
* xref:shedlock-jdbc.adoc[Shedlock JDBC provider] | ||
* xref:shedlock-mongo.adoc[Shedlock mongo provider] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
= Shedlock In Memory Provider | ||
|
||
include::./includes/attributes.adoc[] | ||
|
||
Shedlock In Memory provider give the ability to apply `local` locks. Under the hood an `HashMap` is used to store the locks. | ||
|
||
[[installation]] | ||
== Installation | ||
|
||
If you want to use this extension, you need to add the `io.quarkiverse.shedlock:quarkus-shedlock-provider-inmemory` extension first to your build file. | ||
|
||
For instance, with Maven, add the following dependency to your POM file: | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<dependency> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-provider-inmemory</artifactId> | ||
<version>{project-version}</version> | ||
</dependency> | ||
---- | ||
|
||
[[configuring]] | ||
== Configuring | ||
|
||
The `quarkus.shedlock.defaults-lock-at-most-for` application property is mandatory. | ||
|
||
[[extension-configuration-reference]] | ||
== Extension Configuration Reference | ||
|
||
include::includes/quarkus-shedlock.adoc[opts=optional, leveloffset=+1] | ||
|
||
[source,properties] | ||
.src/main/resources/application.properties | ||
---- | ||
quarkus.shedlock.defaults-lock-at-most-for=PT30S | ||
---- | ||
|
||
[[how-to-use-it]] | ||
== How to use it | ||
|
||
To activate the lock on a method just annotate it with `@InMemorySchedulerLock`. | ||
|
||
[source,java] | ||
---- | ||
include::{examples-dir}/InMemorySchedulerLockService.java[indent=0,tabsize=2] | ||
---- | ||
|
||
The lock duration can be defined on the annotation directly likes this way: | ||
|
||
[source,java] | ||
---- | ||
include::{examples-dir}/InMemorySchedulerLockServiceOptions.java[indent=0,tabsize=2] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
= Shedlock In Memory Provider | ||
|
||
include::./includes/attributes.adoc[] | ||
|
||
Shedlock Jdbc provider give the ability to apply `distributed` locks using a jdbc database. | ||
|
||
[[installation]] | ||
== Installation | ||
|
||
If you want to use this extension, you need to add the `io.quarkiverse.shedlock:quarkus-shedlock-provider-jdbc` extension first to your build file with a `jdbc datasource`. | ||
|
||
For instance, with Maven, add the following dependency to your POM file: | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<dependency> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-provider-jdbc</artifactId> | ||
<version>{project-version}</version> | ||
</dependency> | ||
---- | ||
|
||
and a jdbc datasource likes postgresql | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-jdbc-postgresql</artifactId> | ||
</dependency> | ||
---- | ||
|
||
[[configuring]] | ||
== Configuring | ||
|
||
The `quarkus.shedlock.defaults-lock-at-most-for` application property is mandatory. The table name is defined to `shedlock` and can be overridden for the default datasource or another named jdbc datasource. | ||
|
||
[source,properties] | ||
.src/main/resources/application.properties | ||
---- | ||
quarkus.shedlock.defaults-lock-at-most-for=PT30S | ||
quarkus.datasource.db-kind=postgresql | ||
---- | ||
|
||
[[extension-configuration-reference]] | ||
== Extension Configuration Reference | ||
|
||
include::includes/quarkus-shedlock.adoc[opts=optional, leveloffset=+1] | ||
|
||
include::includes/quarkus-shedlock-jdbc.adoc[opts=optional, leveloffset=+1] | ||
|
||
== How to use it | ||
|
||
To activate the lock on a method just annotate it with `@JdbcSchedulerLock`. | ||
|
||
[source,java] | ||
---- | ||
include::{examples-dir}/JdbcSchedulerLockService.java[indent=0,tabsize=2] | ||
---- | ||
|
||
By default, the lock is bound to the `default` datasource. | ||
|
||
The lock duration and dataSourceName can be defined on the annotation directly likes this way: | ||
|
||
[source,java] | ||
---- | ||
include::{examples-dir}/JdbcSchedulerLockServiceOptions.java[indent=0,tabsize=2] | ||
---- | ||
|
||
Regarding this sample a `master` datasource must be defined has well. | ||
|
||
[source,properties] | ||
.src/main/resources/application.properties | ||
---- | ||
quarkus.shedlock.defaults-lock-at-most-for=PT30S | ||
quarkus.datasource.master.db-kind=postgresql | ||
---- | ||
|
||
if the datasource does not exist the application will refuse to start and a message will be produce to help configuring the application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
= Shedlock In Memory Provider | ||
|
||
include::./includes/attributes.adoc[] | ||
|
||
Shedlock Mongo provider give the ability to apply `distributed` locks using a mongo database. | ||
|
||
[[installation]] | ||
== Installation | ||
|
||
If you want to use this extension, you need to add the `io.quarkiverse.shedlock:quarkus-shedlock-provider-mongo` extension first to your build file. | ||
|
||
For instance, with Maven, add the following dependency to your POM file: | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<dependency> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-provider-mongo</artifactId> | ||
<version>{project-version}</version> | ||
</dependency> | ||
---- | ||
|
||
[[configuring]] | ||
== Configuring | ||
|
||
The `quarkus.shedlock.defaults-lock-at-most-for` application property is mandatory. The collection naming is defined to `shedlock` and cannot be overridden. | ||
The database name is defined to `shedlock` and it is possible to override it depending on the mongo client name. | ||
|
||
[source,properties] | ||
.src/main/resources/application.properties | ||
---- | ||
quarkus.shedlock.defaults-lock-at-most-for=PT30S | ||
quarkus.shedlock.mongo.cluster1.database-name=customDatabase | ||
---- | ||
|
||
[[extension-configuration-reference]] | ||
== Extension Configuration Reference | ||
|
||
include::includes/quarkus-shedlock.adoc[opts=optional, leveloffset=+1] | ||
|
||
include::includes/quarkus-shedlock-mongo.adoc[opts=optional, leveloffset=+1] | ||
|
||
== How to use it | ||
|
||
To activate the lock on a method just annotate it with `@MongoSchedulerLock`. | ||
|
||
[source,java] | ||
---- | ||
include::{examples-dir}/MongoSchedulerLockService.java[indent=0,tabsize=2] | ||
---- | ||
|
||
By default, the lock is bound to the `default` mongo client. | ||
|
||
The lock duration and mongoClientName can be defined on the annotation directly likes this way: | ||
|
||
[source,java] | ||
---- | ||
include::{examples-dir}/MongoSchedulerLockServiceOptions.java[indent=0,tabsize=2] | ||
---- |
Empty file.