Module: Sbmt::KafkaConsumer::Routing::Wildcards::Feature::ConsumerGroup

Defined in:
lib/sbmt/kafka_consumer/routing/wildcards/feature.rb

Instance Method Summary collapse

Instance Method Details

#wildcard=(regexp, &block) ⇒ Object

Raises:

  • (::Karafka::Errors::InvalidConfigurationError)


9
10
11
12
13
14
15
16
# File 'lib/sbmt/kafka_consumer/routing/wildcards/feature.rb', line 9

def wildcard=(regexp, &block)
  Contract.new.validate!({regexp: regexp})

  matching_topics = ::Sbmt::KafkaConsumer::Routing::ListExistingTopics.call(regexp)
  raise ::Karafka::Errors::InvalidConfigurationError, "there's no topics matching regexp #{regexp}" if matching_topics.blank?

  matching_topics.each { |topic_name| public_send(:topic=, topic_name, &block) }
end