-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pluralize the :topic initialization option #17
base: master
Are you sure you want to change the base?
Conversation
dbcd6c9
to
eb2a030
Compare
lib/rafka/consumer.rb
Outdated
@@ -199,11 +199,17 @@ def commit(*msgs) | |||
# @return [Array<Hash, Hash>] rafka opts, redis opts | |||
def parse_opts(opts) | |||
REQUIRED_OPTS.each do |opt| | |||
raise "#{opt.inspect} option not provided" if opts[opt].nil? | |||
raise "#{opt.inspect} option not provided" if opts[opt].nil? || opt[opt].empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be opts[opt].empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed.
By default, kafka and kafka-go support consumers subscribing to multiple topics, by passing an array of strings. Rafka also respects this (see server.go#parseTopicsAndConfig). Rafka-rb simply needs to change the wording in order to respect the plural and in effect show the api user that consuming from multiple topics is supported. The commit takes the extra step of supporting an array of strings as well as a single string, whether it contains a single topic or multiple comma-separated topics. Closes #5
eb2a030
to
78ae428
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep backward-compatibility like so:
Rafka::Consumer.new(topic: "greetings")
Rafka::Consumer.new(topic: ["greetings", "foos"]
Support both topic & topics ? or just topic? |
By default, kafka and kafka-go support consumers subscribing to
multiple topics, by passing an array of strings.
Rafka also respects this.
Rafka-rb simply needs to change the wording in order to respect
the plural and in effect show the api user that consuming from
multiple topics is supported.
The commit takes the extra step of supporting an array of strings
as well as a single string, whether it contains a single topic or
multiple comma-separated topics.
Closes #5