wistia / nsq-ruby

NSQ Ruby client
MIT License
68 stars 27 forks source link

issue discovering #ephemeral topics #27

Closed mschneider82 closed 8 years ago

mschneider82 commented 8 years ago

Hi again,

by using #ephemeral suffix in a channel or topicname, nsq discards message overflow (rather than write to disk) and the topic or channel disappears when there are no longer clients subscribed.

In nsq-ruby we have issues discovering topics with the #ephemeral suffix (eg. topic name: test#ephemeral), nsq-ruby uses URI to connect to the nsqlookupd http interface.

looking at the code nsq-ruby/lib/nsq/discovery.rb:73 it doesn't urlencode the #{topic}

With enabled debugging nsqlookupd -verbose we can see that the client library just asks the nsqlookupd for topic "test" but it should be "test%23ephemeral"

mschneider82 commented 8 years ago

the urlencode is only needed when using jruby 1.9, the uri.query is checked there and raises a InvalidComponentError if there is a # in the query.

bschwartz commented 8 years ago

@mschneider82 Ahh, that makes sense! I'll add it back in and bump the version. Thanks!