Install:
go get github.com/memsql/keyeddistributor
Keyeddistributor is an add-on to eventdistributor that allows for ad-hoc subscription to events that match a key value.
keyed := keyeddistributor.New(func(t Thing) ThingKey) {
return t.Key // or whatever is needed to extract a ThingKey from a Thing
})
reader := keyed.Subscribe("some key value")
defer reader.Unsubscribe()
<-reader.WaitChan()
thing := reader.Consume()
// do stuff with thing