aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlexander Kiryukhin <alexander@kiryukhin.su>2019-04-04 22:56:53 +0300
committerAlexander Kiryukhin <alexander@kiryukhin.su>2019-04-04 22:56:53 +0300
commitc691d422395cb72283512d8956a255db10b70b44 (patch)
treec913d176c23495a8aa82ecc98089de10074c0929 /README.md
parent04db7b633980e7c39e582479ea41608907aa45b2 (diff)
v0.4.3v0.4.3
Added: - Hooks for lifecycle events Fixed: - Close errors channel - Small fixes
Diffstat (limited to 'README.md')
-rwxr-xr-xREADME.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index b3c5ceb..fa1a88f 100755
--- a/README.md
+++ b/README.md
@@ -96,6 +96,27 @@ err := <- r.Errors()
Disabled by default. Use `r.With(rutina.WithErrChan())` to turn on.
+## Events and hooks
+
+Rutina has own simple lifecycle events system. You can subscribe your hooks on any of this events:
+
+* `EventRoutineStart` - Fires when starts new routine
+* `EventRoutineStop` - Fires when routine stopped with any result
+* `EventRoutineComplete` - Fires when routine stopped without errors
+* `EventRoutineFail` - Fires when routine stopped with error
+* `EventAppStop` - Fires when all routines stopped with any result
+* `EventAppComplete` - Fires when all routines stopped with no errors
+* `EventAppFail` - Fires when all routines stopped with error
+
+Example:
+
+```go
+r.RegisterHook(rutina.EventRoutineStart, func(ev rutina.Event, rid int) error {
+ log.Println("Started routine with ID", rid)
+ return nil
+})
+```
+
## Mixins
### Usage