summaryrefslogtreecommitdiff
path: root/interfaces/events/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'interfaces/events/handler.go')
-rw-r--r--interfaces/events/handler.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/interfaces/events/handler.go b/interfaces/events/handler.go
new file mode 100644
index 00000000..ac6c15a4
--- /dev/null
+++ b/interfaces/events/handler.go
@@ -0,0 +1,14 @@
+package events
+
+// Handler interface
+type Handler interface {
+ // Return number of active listeners
+ NumListeners() int
+ // AddListener adds lister to the publisher
+ AddListener(listener Listener)
+ // Push pushes event to the listeners
+ Push(e interface{})
+}
+
+// Event listener listens for the events produced by worker, worker pool or other service.
+type Listener func(event interface{})