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()
}
Description
Yet another in-memory Go PubSub library.
Readme MIT 3.1 MiB
Languages
Go 100%