rill.wheel.trigger
Triggers are called when events are committed.
install-trigger
(install-trigger event-type key f)
Globally register a callback f
for event-type
with key key
. Replaces previously installed trigger with event-type
and key
.
When a matching event
is succesfully committed to repository
, callback will be called as (f repository target-aggregate event)
, where target-aggregate
is the target of event
in the state prior to commit.
remove-trigger
(remove-trigger event-type key)
triggers
Global registry of triggers. Atom containing map of event-type -> key -> callback.
with-triggers
(with-triggers repo)
Wrap a repository with triggers. The standard rill.wheel
repository constructors call this wrapper so library users should not have to call this function.