StructuredHub.Subscribe(pubsub.MatchAll, ...) works #3

Closed
jameinel opened this Issue Jul 14, 2016 · 1 comment

Comments

Projects
None yet
2 participants
Owner

jameinel commented Jul 14, 2016

Multiplexer uses a different method (Add) than Hub (Subscribe), but I was reworking a test to go straight to the hub instead of the Multiplexer, but it was perfectly happy with this:
sub, err := hub.Subscribe(pubsub.MatchAll, func(topic pubsub.Topic, s Emitter, err error) {
counters[mycounter]++
})
c.Assert(err, jc.ErrorIsNil)
defer sub.Unsubscribe()

I'm a bit surprised as I would think Subscribe requires a Topic, while Add requires a TopicMatcher, why would MatchAll be allowed as a Topic?
(The confusing part is the Subscribe passed just fine, but then none of the Publish()ed messages got through.)

Owner

howbazaar commented Jul 15, 2016

Subscribe does need a TopicMatcher. Hard to know what you have changed without seeing the code.

Sounds like there is some weirdness going on with your test, but hard to see. Got a gist or pastebin?

Also, the multiplexer does use a different method because it is doing a different thing. Calling it subscribe would be wrong.

@howbazaar howbazaar self-assigned this Jul 15, 2016

@howbazaar howbazaar closed this Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment