Reactions trigger actions when specific conditions are met.
Reactions react to a specific event and trigger an action whenever that event is processed by the event reactor service provided by Serialied. An example could be sending a confirmation email to a customer when an order has been successfully placed.
When do you need Reactions?
Reactions provide a managed service that can drive actions for you, based on events that you store in Serialized. In summary you can use Reactions to:
- Call an external service as a consequence of saving a Domain Event.
- Schedule a trigger based on a Domain Event.
- Drive long-running processes by calling services of your own that will store new Domain Events in Serialized.
Each reaction is configured with a specific
Action that defines what will happen when the reaction is triggered. When a Reaction is triggered it will execute its configured Action.
Currently Serialized offer the following action types:
- Generic HTTP action for any system capable of receiving HTTP POST requests such as an AWS Lambda.
The default Reaction time is immediate. The reaction will execute its action as soon as the event is received and processed by the event reactor. You can however configure when a Reaction should invoke an action for a matching event by configuring its execution time.
A scheduled Reaction is configured to wait a certain time before executing its action. This makes it possible to implement use-cases such as reminders, loyalty awards or other cases where time is an important factor.
Scheduled Reactions can be scheduled to run at any of the following times:
- At a future point in time specified by a field in the event data
- Fixed offset to a future point in time specified by a field in the event data
- Fixed offset to the event process time
Cancelling scheduled reactions
It's possible to specify one or more event types that cancels scheduled reactions. For instance, an
AddressConfirmed event might cancel a scheduled