Skip to content

Jun10ng/goeventbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What

a simple event bus in golang

Use

	bus := NewBus()
	sub := NewSub()

	bus.Subscribe("topic1", sub)

	go func() {
		msg := sub.Out().(int)
		if msg != 7 {
			t.Fatalf("got wrong number:%d", msg)
		}
	}()
	bus.Publish("topic1", 7)
	// or use PubFunc to publish to a certain topic
	pubFunc := bus.PubFunc("topic1")
	pubFunc(7)

For more details,see testfile

About

a simple event bus in golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages