Interface Trigger<S,E>
- Type Parameters:
S- the type of stateE- the type of event
- All Known Implementing Classes:
EventTrigger,TimerTrigger
public interface Trigger<S,E>
Trigger is the cause of the Transition. Cause is usually an
event but can be some other signal or a change in some condition.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTriggerListener(TriggerListener listener) Adds the trigger listener.voidarm()Arm a trigger.voiddisarm()Disarm a trigger.reactor.core.publisher.Mono<Boolean>evaluate(TriggerContext<S, E> context) Evaluate trigger.getEvent()Gets the event associated with this trigger.
-
Method Details
-
evaluate
Evaluate trigger.- Parameters:
context- the context- Returns:
- Mono for completion with true, if trigger is fired, false otherwise
-
addTriggerListener
Adds the trigger listener.- Parameters:
listener- the listener
-
getEvent
E getEvent()Gets the event associated with this trigger. It is possible that there are no event association.- Returns:
- the event
-
arm
void arm()Arm a trigger. After trigger has been armed aTriggerListenermay receive events. -
disarm
void disarm()Disarm a trigger. After trigger has been disarmed aTriggerListenerwill not receive events.
-