lib/deimos/config/configuration.rb in deimos-ruby-1.20.1 vs lib/deimos/config/configuration.rb in deimos-ruby-1.22

- old
+ new

@@ -5,11 +5,11 @@ require_relative '../metrics/mock' require_relative '../tracing/mock' require 'active_support/core_ext/numeric' # :nodoc: -module Deimos +module Deimos # rubocop:disable Metrics/ModuleLength include FigTree # :nodoc: class FigTree::ConfigStruct include Deimos::PhobosConfig @@ -85,10 +85,16 @@ topic(kafka_config.topic) if kafka_config.topic.present? && klass.respond_to?(:topic) schema(kafka_config.schema) if kafka_config.schema.present? namespace(kafka_config.namespace) if kafka_config.namespace.present? key_config(**kafka_config.key_config) if kafka_config.key_config.present? schema_class_config(kafka_config.use_schema_classes) if kafka_config.use_schema_classes.present? + if kafka_config.respond_to?(:bulk_import_id_column) # consumer + klass.config.merge!( + bulk_import_id_column: kafka_config.bulk_import_id_column, + replace_associations: kafka_config.replace_associations + ) + end end end define_settings do @@ -400,10 +406,14 @@ # @return [Hash] setting :key_config # Configure the usage of generated schema classes for this producer # @return [Boolean] setting :use_schema_classes + # If true, and using the multi-table feature of ActiveRecordConsumers, replace associations + # instead of appending to them. + # @return [Boolean] + setting :replace_associations end setting_object :consumer do # Consumer class. # @return [String] @@ -428,9 +438,15 @@ # @return [Boolean] setting :use_schema_classes # Optional maximum limit for batching database calls to reduce the load on the db. # @return [Integer] setting :max_db_batch_size + # Column to use for bulk imports, for multi-table feature. + # @return [String] + setting :bulk_import_id_column, :bulk_import_id + # If true, multi-table consumers will blow away associations rather than appending to them. + # @return [Boolean] + setting :replace_associations, true # These are the phobos "listener" configs. See CONFIGURATION.md for more # info. setting :group_id setting :max_concurrency, 1