Package io.github.zero88.schedulerx.impl
Class TriggerContextFactory
java.lang.Object
io.github.zero88.schedulerx.impl.TriggerContextFactory
The factory to create trigger context.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull TriggerContextCreate a trigger context inTriggerCondition.TriggerStatus.STOPPEDstate withTriggerCondition.ReasonCode.ON_CANCELreason.static TriggerContextCreate a trigger context inTriggerCondition.TriggerStatus.ERRORstate.static @NotNull TriggerContextexecuted(@NotNull TriggerContext ctx) Transition trigger context toTriggerCondition.TriggerStatus.EXECUTEDstate.static @NotNull TriggerContextCreate trigger context inTriggerCondition.TriggerStatus.KICKOFFstatestatic <T> @NotNull TriggerContextCreate trigger context inTriggerCondition.TriggerStatus.KICKOFFstatestatic @NotNull TriggerContextready(@NotNull TriggerContext ctx) Transition trigger context toTriggerCondition.TriggerStatus.READYstate.static @NotNull TriggerContextrescheduled(@NotNull String triggerType, long tick) Create trigger context inTriggerCondition.TriggerStatus.SCHEDULEDstate withTriggerCondition.ReasonCode.ON_RESCHEDULEreasonstatic @NotNull TriggerContextCreate trigger context inTriggerCondition.TriggerStatus.SCHEDULEDstate withTriggerCondition.ReasonCode.ON_SCHEDULEreasonstatic @NotNull TriggerContextskip(@NotNull TriggerContext ctx, @NotNull String reason) Transition trigger context toTriggerCondition.TriggerStatus.SKIPPEDstate.static @NotNull TriggerContextskip(@NotNull TriggerContext ctx, @NotNull String reason, @NotNull Throwable cause) Transition trigger context toTriggerCondition.TriggerStatus.SKIPPEDstate.static @NotNull TriggerContextstop(@NotNull TriggerContext ctx, @Nullable String reason) Transition trigger context toTriggerCondition.TriggerStatus.STOPPEDstate.
-
Method Details
-
scheduled
Create trigger context inTriggerCondition.TriggerStatus.SCHEDULEDstate withTriggerCondition.ReasonCode.ON_SCHEDULEreason- Parameters:
triggerType- the trigger type
-
rescheduled
@NotNull public static @NotNull TriggerContext rescheduled(@NotNull @NotNull String triggerType, long tick) Create trigger context inTriggerCondition.TriggerStatus.SCHEDULEDstate withTriggerCondition.ReasonCode.ON_RESCHEDULEreason- Parameters:
triggerType- the trigger typetick- the tick at the rescheduled time
-
error
public static TriggerContext error(String triggerType, String reason, @Nullable @Nullable Throwable cause) Create a trigger context inTriggerCondition.TriggerStatus.ERRORstate.- Parameters:
triggerType- the trigger typereason- the transition reasoncause- the failed cause
-
cancel
Create a trigger context inTriggerCondition.TriggerStatus.STOPPEDstate withTriggerCondition.ReasonCode.ON_CANCELreason.- Parameters:
triggerType- the trigger typetick- the current tick
-
kickoff
@NotNull public static @NotNull TriggerContext kickoff(@NotNull @NotNull String triggerType, @NotNull @NotNull Instant firedAt, long tick) Create trigger context inTriggerCondition.TriggerStatus.KICKOFFstate- Parameters:
triggerType- the trigger typefiredAt- the fired attick- the tick
-
kickoff
@NotNull public static <T> @NotNull TriggerContext kickoff(@NotNull @NotNull String triggerType, @NotNull @NotNull Instant firedAt, long tick, @Nullable T info) Create trigger context inTriggerCondition.TriggerStatus.KICKOFFstate- Parameters:
triggerType- the trigger typefiredAt- the fired attick- the tickinfo- the trigger context info
-
ready
Transition trigger context toTriggerCondition.TriggerStatus.READYstate.- Parameters:
ctx- the current trigger context
-
executed
Transition trigger context toTriggerCondition.TriggerStatus.EXECUTEDstate.- Parameters:
ctx- the current trigger context
-
skip
@NotNull public static @NotNull TriggerContext skip(@NotNull @NotNull TriggerContext ctx, @NotNull @NotNull String reason) Transition trigger context toTriggerCondition.TriggerStatus.SKIPPEDstate.- Parameters:
ctx- the current trigger contextreason- the transition reason
-
skip
@NotNull public static @NotNull TriggerContext skip(@NotNull @NotNull TriggerContext ctx, @NotNull @NotNull String reason, @NotNull @NotNull Throwable cause) Transition trigger context toTriggerCondition.TriggerStatus.SKIPPEDstate.- Parameters:
ctx- the current trigger contextreason- the transition reasoncause- the transition cause
-
stop
@NotNull public static @NotNull TriggerContext stop(@NotNull @NotNull TriggerContext ctx, @Nullable @Nullable String reason) Transition trigger context toTriggerCondition.TriggerStatus.STOPPEDstate.- Parameters:
ctx- the current trigger contextreason- the transition reason
-