Sha256: 99b9a1ed4f52bc72c89dc48a613c60be933c92627a906cb8dd6aba724b8b3225
Contents?: true
Size: 1.06 KB
Versions: 42
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Karafka # Namespace for all elements related to requests routing module Routing # Karafka framework Router for routing incoming messages to proper consumers # @note Since Kafka does not provide namespaces or modules for topics, they all have "flat" # structure so all the routes are being stored in a single level array module Router # Find a proper topic based on full topic id # @param topic_id [String] proper topic id (already mapped, etc) for which we want to find # routing topic # @return [Karafka::Routing::Topic] proper route details # @raise [Karafka::Topic::NonMatchingTopicError] raised if topic name does not match # any route defined by user using routes.draw def find(topic_id) App.consumer_groups.each do |consumer_group| consumer_group.topics.each do |topic| return topic if topic.id == topic_id end end raise(Errors::NonMatchingRouteError, topic_id) end module_function :find end end end
Version data entries
42 entries across 42 versions & 1 rubygems