Class: Dionysus::Consumer::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dionysus/consumer/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#consumer_base_classObject



63
64
65
# File 'lib/dionysus/consumer/config.rb', line 63

def consumer_base_class
  @consumer_base_class || Karafka::BaseConsumer
end

#event_busObject



35
36
37
# File 'lib/dionysus/consumer/config.rb', line 35

def event_bus
  @event_bus || Dionysus::Utils::NullEventBus
end

#instrumenterObject



31
32
33
# File 'lib/dionysus/consumer/config.rb', line 31

def instrumenter
  @instrumenter || Dionysus::Utils::NullInstrumenter
end

#message_filtersObject



103
104
105
# File 'lib/dionysus/consumer/config.rb', line 103

def message_filters
  @message_filters || Array.wrap(message_filter)
end

#model_factoryObject



19
20
21
# File 'lib/dionysus/consumer/config.rb', line 19

def model_factory
  @model_factory || Dionysus::Utils::NullModelFactory
end

#processing_mutex_method_nameObject



27
28
29
# File 'lib/dionysus/consumer/config.rb', line 27

def processing_mutex_method_name
  @processing_mutex_method_name || :with_lock
end

#processing_mutex_providerObject



23
24
25
# File 'lib/dionysus/consumer/config.rb', line 23

def processing_mutex_provider
  @processing_mutex_provider || Dionysus::Utils::NullMutexProvider
end

#registryObject

Returns the value of attribute registry.



4
5
6
# File 'lib/dionysus/consumer/config.rb', line 4

def registry
  @registry
end

#resolve_synced_data_hash_procObject



83
84
85
86
87
# File 'lib/dionysus/consumer/config.rb', line 83

def resolve_synced_data_hash_proc
  @resolve_synced_data_hash_proc || lambda do |record|
    record.public_send(Dionysus::Consumer.configuration.synced_data_attribute).to_h
  end
end

#retry_providerObject



67
68
69
# File 'lib/dionysus/consumer/config.rb', line 67

def retry_provider
  @retry_provider || Dionysus::Utils::NullRetryProvider
end

#sidekiq_queueObject



89
90
91
# File 'lib/dionysus/consumer/config.rb', line 89

def sidekiq_queue
  @sidekiq_queue || self.class.default_sidekiq_queue
end

#soft_delete_strategyObject



39
40
41
# File 'lib/dionysus/consumer/config.rb', line 39

def soft_delete_strategy
  @soft_delete_strategy || :cancel
end

#soft_deleted_at_timestamp_attributeObject



43
44
45
# File 'lib/dionysus/consumer/config.rb', line 43

def soft_deleted_at_timestamp_attribute
  @soft_deleted_at_timestamp_attribute || :synced_canceled_at
end

#synced_created_at_timestamp_attributeObject



47
48
49
# File 'lib/dionysus/consumer/config.rb', line 47

def synced_created_at_timestamp_attribute
  @synced_created_at_timestamp_attribute || :synced_created_at
end

#synced_data_attributeObject



59
60
61
# File 'lib/dionysus/consumer/config.rb', line 59

def synced_data_attribute
  @synced_data_attribute || :synced_data
end

#synced_id_attributeObject



55
56
57
# File 'lib/dionysus/consumer/config.rb', line 55

def synced_id_attribute
  @synced_id_attribute || :synced_id
end

#synced_updated_at_timestamp_attributeObject



51
52
53
# File 'lib/dionysus/consumer/config.rb', line 51

def synced_updated_at_timestamp_attribute
  @synced_updated_at_timestamp_attribute || :synced_updated_at
end

#transaction_providerObject



15
16
17
# File 'lib/dionysus/consumer/config.rb', line 15

def transaction_provider
  @transaction_provider || Dionysus::Utils::NullTransactionProvider
end

Class Method Details

.default_sidekiq_queueObject



11
12
13
# File 'lib/dionysus/consumer/config.rb', line 11

def self.default_sidekiq_queue
  :dionysus
end

Instance Method Details

#add_attributes_mapping_for_model(model_name) ⇒ Object



71
72
73
# File 'lib/dionysus/consumer/config.rb', line 71

def add_attributes_mapping_for_model(model_name)
  attributes_mapping_for_models[model_name.to_s] = yield
end

#attributes_mapping_for_model(model_name) ⇒ Object



79
80
81
# File 'lib/dionysus/consumer/config.rb', line 79

def attributes_mapping_for_model(model_name)
  attributes_mapping_for_models.fetch(model_name.to_s, {})
end

#attributes_mapping_for_modelsObject



75
76
77
# File 'lib/dionysus/consumer/config.rb', line 75

def attributes_mapping_for_models
  @attributes_mapping_for_models ||= {}
end

#message_filterObject



93
94
95
96
# File 'lib/dionysus/consumer/config.rb', line 93

def message_filter
  @message_filter || Dionysus::Utils::DefaultMessageFilter.new(error_handler:
    Dionysus::Utils::NullErrorHandler)
end

#message_filter=(val) ⇒ Object



98
99
100
101
# File 'lib/dionysus/consumer/config.rb', line 98

def message_filter=(val)
  @message_filter = val
  self.message_filters = [val]
end