Interface SideEffectHandler
- All Known Implementing Classes:
TestSideEffectHandler
public interface SideEffectHandler
Component capable of managing side effect persistence and handling. Implementations are provided
by a backing system.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activityBoundary
(String name, boolean isEnd) Do work at activity start or end.void
activityBoundary
(String name, Duration duration, boolean isEnd) Do work at activity start or end.<R> R
addSideEffect
(Class<?> resultClass, Functions.Func<R> func, Object activity) Executes the provided function once, records its result into the workflow history.void
Apply any recently received side effects (outside the normal thread of execution).void
flush()
Flush any hanging side effect information at the end of replay
-
Method Details
-
addSideEffect
Executes the provided function once, records its result into the workflow history. The recorded result on history will be returned without executing the provided function during replay. This guarantees the deterministic requirement for workflow as the exact same result will be returned in replay.- Parameters:
resultClass
- type of the side effectfunc
- function that returns side effect value- Returns:
- value of the side effect
-
activityBoundary
Do work at activity start or end.- Parameters:
name
- The name of the activity.isEnd
- Whether this is the end of the activity (false if the start)
-
activityBoundary
Do work at activity start or end. If a wait step (seeStep.isWait()
), include the duration of the wait.- Parameters:
name
- The name of the activity.duration
- The duration of the wait stepisEnd
- Whether this is the end of the activity (false if the start)
-
flush
void flush()Flush any hanging side effect information at the end of replay -
applyRecent
void applyRecent()Apply any recently received side effects (outside the normal thread of execution). These types of side effects are almost always signals.
-