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 TriggerContext
Create a trigger context inTriggerCondition.TriggerStatus.STOPPED
state withTriggerCondition.ReasonCode.ON_CANCEL
reason.static TriggerContext
Create a trigger context inTriggerCondition.TriggerStatus.ERROR
state.static @NotNull TriggerContext
executed
(@NotNull TriggerContext ctx) Transition trigger context toTriggerCondition.TriggerStatus.EXECUTED
state.static @NotNull TriggerContext
Create trigger context inTriggerCondition.TriggerStatus.KICKOFF
statestatic <T> @NotNull TriggerContext
Create trigger context inTriggerCondition.TriggerStatus.KICKOFF
statestatic @NotNull TriggerContext
ready
(@NotNull TriggerContext ctx) Transition trigger context toTriggerCondition.TriggerStatus.READY
state.static @NotNull TriggerContext
rescheduled
(@NotNull String triggerType, long tick) Create trigger context inTriggerCondition.TriggerStatus.SCHEDULED
state withTriggerCondition.ReasonCode.ON_RESCHEDULE
reasonstatic @NotNull TriggerContext
Create trigger context inTriggerCondition.TriggerStatus.SCHEDULED
state withTriggerCondition.ReasonCode.ON_SCHEDULE
reasonstatic @NotNull TriggerContext
skip
(@NotNull TriggerContext ctx, @NotNull String reason) Transition trigger context toTriggerCondition.TriggerStatus.SKIPPED
state.static @NotNull TriggerContext
skip
(@NotNull TriggerContext ctx, @NotNull String reason, @NotNull Throwable cause) Transition trigger context toTriggerCondition.TriggerStatus.SKIPPED
state.static @NotNull TriggerContext
stop
(@NotNull TriggerContext ctx, @Nullable String reason) Transition trigger context toTriggerCondition.TriggerStatus.STOPPED
state.
-
Method Details
-
scheduled
Create trigger context inTriggerCondition.TriggerStatus.SCHEDULED
state withTriggerCondition.ReasonCode.ON_SCHEDULE
reason- Parameters:
triggerType
- the trigger type
-
rescheduled
@NotNull public static @NotNull TriggerContext rescheduled(@NotNull @NotNull String triggerType, long tick) Create trigger context inTriggerCondition.TriggerStatus.SCHEDULED
state withTriggerCondition.ReasonCode.ON_RESCHEDULE
reason- 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.ERROR
state.- Parameters:
triggerType
- the trigger typereason
- the transition reasoncause
- the failed cause
-
cancel
Create a trigger context inTriggerCondition.TriggerStatus.STOPPED
state withTriggerCondition.ReasonCode.ON_CANCEL
reason.- 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.KICKOFF
state- 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.KICKOFF
state- Parameters:
triggerType
- the trigger typefiredAt
- the fired attick
- the tickinfo
- the trigger context info
-
ready
Transition trigger context toTriggerCondition.TriggerStatus.READY
state.- Parameters:
ctx
- the current trigger context
-
executed
Transition trigger context toTriggerCondition.TriggerStatus.EXECUTED
state.- 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.SKIPPED
state.- 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.SKIPPED
state.- 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.STOPPED
state.- Parameters:
ctx
- the current trigger contextreason
- the transition reason
-