541c46bc314383f469f981b8c71641b30f0dcae6
GubGub
Another Go PubSub library.
Getting started
go get -u gitlab.com/naterciom/gubgub
Example
package main
import (
"context"
"fmt"
"time"
"gitlab.com/naterciom/gubgub"
)
type MyMessage struct {
Name string
}
func main() {
ctx, cancel := context.WithTimeout(context.TODO(), time.Second)
defer cancel()
topic := gubgub.NewAsyncTopic[MyMessage](ctx)
topic.Subscribe(gubgub.Forever(func(msg MyMessage) {
fmt.Printf("Hello %s", msg.Name)
}))
topic.Publish(MyMessage{Name: "John Smith"})
<-ctx.Done()
}
Languages
Go
100%