luet/vendor/github.com/mudler/go-pluggable
2020-11-13 19:50:10 +01:00
..
bus.go Update go-pluggable 2020-11-13 19:50:10 +01:00
events.go Update go-pluggable 2020-11-13 19:50:10 +01:00
go.mod Update go-pluggable 2020-11-13 19:50:10 +01:00
go.sum Update go-pluggable 2020-11-13 19:50:10 +01:00
LICENSE Update go-pluggable 2020-11-13 19:50:10 +01:00
manager.go Update go-pluggable 2020-11-13 19:50:10 +01:00
plugin.go Update go-pluggable 2020-11-13 19:50:10 +01:00
README.md Update go-pluggable 2020-11-13 19:50:10 +01:00

go-pluggable

light Bus-event driven plugin library for Golang.

go-pluggable implements the event/sub pattern to extend your Golang project with external binary plugins that can be written in any language.

import "github.com/mudler/go-pluggable"


func main() {

    var myEv pluggableEventType = "something.to.hook.on"
    temp := "/usr/custom/bin"

    m = pluggable.NewManager(
        []pluggable.EventType{
            myEv,
        },
    )
        
    // We have a file 'test-foo' in temp.
    // 'test-foo' will receive our event payload in json
    m.Autoload("test", temp)
    m.Register()

    // ...
    m.Publish(myEv,  map[string]string{"foo": "bar"}) // test-foo, will receive our data as json payload
}