-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#93): refactor TriggerEvaluator interface API
- Loading branch information
Showing
7 changed files
with
111 additions
and
48 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
core/src/main/java/io/github/zero88/schedulerx/trigger/AfterTriggerEvaluator.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,28 @@ | ||
package io.github.zero88.schedulerx.trigger; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import io.vertx.core.Future; | ||
|
||
/** | ||
* Represents for the trigger context checker on after trigger | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@FunctionalInterface | ||
public interface AfterTriggerEvaluator { | ||
|
||
/** | ||
* Verify if the trigger should stop executing immediately after one round of execution begins. | ||
* | ||
* @param trigger the trigger | ||
* @param triggerContext the trigger context | ||
* @param externalId the job external id | ||
* @param round the current execution round | ||
* @since 2.0.0 | ||
*/ | ||
@NotNull Future<TriggerContext> afterTrigger(@NotNull Trigger trigger, @NotNull TriggerContext triggerContext, | ||
@Nullable Object externalId, long round); | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
core/src/main/java/io/github/zero88/schedulerx/trigger/BeforeTriggerEvaluator.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,27 @@ | ||
package io.github.zero88.schedulerx.trigger; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import io.vertx.core.Future; | ||
|
||
/** | ||
* Represents for the trigger context checker on before trigger | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@FunctionalInterface | ||
public interface BeforeTriggerEvaluator { | ||
|
||
/** | ||
* Verify if the trigger can run before each execution round is started. | ||
* | ||
* @param trigger the trigger | ||
* @param triggerContext the trigger context | ||
* @param externalId the job external id | ||
* @return a future of the trigger context that is evaluated | ||
*/ | ||
@NotNull Future<TriggerContext> beforeTrigger(@NotNull Trigger trigger, @NotNull TriggerContext triggerContext, | ||
@Nullable Object externalId); | ||
|
||
} |
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
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