Sha256: e9971f2a33483cdc7890f73253ed7747664f8cb1fb99b541b633d5c61b51bc06
Contents?: true
Size: 1.26 KB
Versions: 18
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true module Karafka module Routing # Default consumer mapper that builds consumer ids based on app id and consumer group name # Different mapper can be used in case of preexisting consumer names or for applying # other naming conventions not compatible wiih Karafkas client_id + consumer name concept # # @example Mapper for using consumer groups without a client_id prefix # module MyMapper # def self.call(raw_consumer_group_name) # raw_consumer_group_name # end # end # # @example Mapper for replacing "_" with "." in topic names # module MyMapper # def self.call(raw_consumer_group_name) # [ # Dry::Inflector.new.underscore(Karafka::App.config.client_id.to_s), # raw_consumer_group_name # ].join('_').gsub('_', '.') # end # end module ConsumerMapper # @param raw_consumer_group_name [String, Symbol] string or symbolized consumer group name # @return [String] remapped final consumer group name def self.call(raw_consumer_group_name) client_name = Dry::Inflector.new.underscore(Karafka::App.config.client_id.to_s) "#{client_name}_#{raw_consumer_group_name}" end end end end
Version data entries
18 entries across 18 versions & 1 rubygems