Sha256: 9d40a4bc4e47e155029d66ce86144b03d595e2367c64a989870e80d88901df4e
Contents?: true
Size: 1.19 KB
Versions: 6
Compression:
Stored size: 1.19 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) # [ # Karafka::App.config.client_id.to_s.underscope, # 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) "#{Karafka::App.config.client_id.to_s.underscore}_#{raw_consumer_group_name}" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems