Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

DRAFT: GUILD-625: Changes required to support multiple topic subscrip…#136

Open
eduardopoleoflipp wants to merge 1 commit into
phobos:masterfrom
eduardopoleoflipp:multiple_topics_per_handler
Open

DRAFT: GUILD-625: Changes required to support multiple topic subscrip…#136
eduardopoleoflipp wants to merge 1 commit into
phobos:masterfrom
eduardopoleoflipp:multiple_topics_per_handler

Conversation

@eduardopoleoflipp

Copy link
Copy Markdown

…tions per listener

@qlty-cloud-legacy

Copy link
Copy Markdown

Code Climate has analyzed commit 0badae9 and detected 0 issues on this pull request.

View more on Code Climate.

@dorner dorner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments. Also, are there specs we can improve to cover this case?

Comment thread lib/phobos/listener.rb
DELIVERY_OPTS = %w[batch message inline_batch].freeze

attr_reader :group_id, :topic, :id
attr_reader :group_id, :topics, :id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For backwards compatibility, let's keep both :topic and :topics and deprecate :topic. attr_reader is public so we have no idea if someone would be accessing this for some reason.

Comment thread lib/phobos/listener.rb
@consumer = create_kafka_consumer
@consumer.subscribe(topic, **@subscribe_opts)

# ruby-kafka does not provide an api to subscribe a group of particular topics

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There technically is one, although it would mean turning topic into a regex that includes all of the topics, e.g.

topic_regex = Regexp.new("^#{topics.join('|')}$")
@consumer.subscribe(topic_regex, **@subscribe_opts)

...but I don't think that's any cleaner at all. :p Maybe just take the comment out.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants