Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

35 lines (28 sloc) 798 Bytes
package events
import (
// Listener is a function capable of handling events
type Listener func(e Event)
// NamedListen for events. Name is the name of the
// listener NOT the events you want to listen for,
// so something like "my-listener", "kafka-listener", etc...
func NamedListen(name string, l Listener) (DeleteFn, error) {
return boss.Listen(name, l)
// Listen for events.
func Listen(l Listener) (DeleteFn, error) {
_, file, line, _ := runtime.Caller(1)
return NamedListen(fmt.Sprintf("%s:%d", file, line), l)
type listable interface {
List() ([]string, error)
// List all listeners
func List() ([]string, error) {
if l, ok := boss.(listable); ok {
return l.List()
return []string{}, fmt.Errorf("manager %T does not implemented listable", boss)
You can’t perform that action at this time.