deimos-ruby 2.0.0.pre.beta1 → 2.0.0.pre.beta3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5a771b9dee159bd0827bd8d3068cec505e8494e9b57a4e9c3038d0d48309dfc
4
- data.tar.gz: 82cb497cc46f8cd3812399a36fd3520b7d7716c1f389d6474dac76326b5761be
3
+ metadata.gz: ab3cdef123f93f1d1413cd4028f25787d5024709a021bc49f40932466a001696
4
+ data.tar.gz: 0d0b0a62f592d517a610d08cbc10372edc541c18d95071f6238c365d5dfc5d98
5
5
  SHA512:
6
- metadata.gz: 3a2ddfdae480ed35c08815d65d708e468e201c7421f9edca36c5df8c725c69821d4a2978c80544028539926fc24e52045a2eda67cafb19458798dadf91cb9c71
7
- data.tar.gz: f8cbd6e123c31a69198fd4c20d2adbda9527258fa35048e15660604cf4aaecd607adfb639ad91d3d6e5b19784555e4096bbd388d2dad33b349b1f9ca4d79af2e
6
+ metadata.gz: 6fd99053fb0cd110dc3518bb798c68920d341d45e1f5d63c2830e06ae467598249812aaf25734137994070c2b09c646291916477e0a07196f84af42f6aca5bcb
7
+ data.tar.gz: 80a510ca35476e303f9189635f12951eb63f0fd4d9145452f22eaaf6f41ddf669cfd5b5ba59008a2e62e7a8facae5e7a5435c0f0af1c8f94528b375765fb1f5f
@@ -66,7 +66,7 @@ module Deimos
66
66
  def record_key(key)
67
67
  if key.nil?
68
68
  {}
69
- elsif key.is_a?(Hash)
69
+ elsif key.is_a?(Hash) || key.is_a?(SchemaClass::Record)
70
70
  self.key_converter.convert(key)
71
71
  elsif self.topic.key_config[:field].nil?
72
72
  { @klass.primary_key => key }
@@ -63,7 +63,7 @@ module Deimos # rubocop:disable Metrics/ModuleLength
63
63
  setting :phobos_logger, removed: 'Separate logger for Phobos is no longer supported'
64
64
 
65
65
  setting :kafka do
66
- setting :logger, removed: "Karafka uses Rails logger by default"
66
+ setting :logger, Logger.new(STDOUT), removed: "Karafka uses Rails logger by default"
67
67
  setting :seed_brokers, ['localhost:9092'], removed: 'Use kafka(bootstrap.servers) in Karafka settings'
68
68
  setting :client_id, 'phobos', removed: 'Use client_id in Karafka setup block.'
69
69
  setting :connect_timeout, 15, removed: 'Use kafka(socket.connection.setup.timeout.ms) in Karafka settings'
@@ -45,8 +45,12 @@ module Deimos
45
45
  if m.respond_to?(:payload)
46
46
  m.key || m.payload['message_id']
47
47
  elsif m
48
- payload = m[:payload]&.with_indifferent_access
49
- m[:key] || m[:payload_key] || payload[:payload_key] || payload[:message_id]
48
+ if m[:payload].is_a?(String)
49
+ m[:key] || m[:payload_key]
50
+ else
51
+ payload = m[:payload]&.with_indifferent_access
52
+ m[:key] || m[:payload_key] || payload[:payload_key] || payload[:message_id]
53
+ end
50
54
  end
51
55
  end
52
56
  log_message.merge!(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '2.0.0-beta1'
4
+ VERSION = '2.0.0-beta3'
5
5
  end
@@ -26,11 +26,11 @@ class KarafkaApp < Karafka::App
26
26
  <%- setup_configs.each do |k, v| -%>
27
27
  config.<%= k %> = <%= v.inspect %>
28
28
  <%- end -%>
29
- config.kafka = {
29
+ config.kafka.merge!({
30
30
  <%- default_kafka_configs.compact.each do |k, v| -%>
31
31
  "<%= k.to_s %>": <%= v.inspect %>,
32
32
  <%- end -%>
33
- }
33
+ })
34
34
  # Recreate consumers with each batch. This will allow Rails code reload to work in the
35
35
  # development mode. Otherwise Karafka process would not be aware of code changes
36
36
  config.consumer_persistence = !Rails.env.development?
@@ -104,6 +104,7 @@ class KarafkaApp < Karafka::App
104
104
  <%- consumer[:kafka].each do |k, v| -%>
105
105
  "<%= k.to_s %>": <%= v.inspect %>,
106
106
  <%- end -%>
107
+ inherit: true
107
108
  )
108
109
  <%- end -%>
109
110
  <%- consumer.except(:topic, :kafka).each do |k, v| -%>
@@ -80,9 +80,9 @@ module Deimos
80
80
  "sasl_plain"
81
81
  end
82
82
  end
83
- configs["ssl.ca.pem"] = deimos_config.kafka.ssl.ca_cert
84
- configs["ssl.certificate.pem"] = deimos_config.kafka.ssl.client_cert
85
- configs["ssl.key.pem"] = deimos_config.kafka.ssl.client_cert_key
83
+ configs["ssl.ca.location"] = deimos_config.kafka.ssl.ca_cert
84
+ configs["ssl.certificate.location"] = deimos_config.kafka.ssl.client_cert
85
+ configs["ssl.key.location"] = deimos_config.kafka.ssl.client_cert_key
86
86
  configs["ssl.endpoint.identification.algorithm"] = "https" if deimos_config.kafka.ssl.verify_hostname
87
87
  configs["sasl.kerberos.principal"] = deimos_config.kafka.sasl.gssapi_principal
88
88
  configs["sasl.kerberos.keytab"] = deimos_config.kafka.sasl.gssapi_keytab
@@ -126,6 +126,7 @@ module Deimos
126
126
  configs[:max_db_batch_size] = consumer.max_db_batch_size unless consumer.default_value?(:max_db_batch_size)
127
127
  configs[:bulk_import_id_column] = consumer.bulk_import_id_column unless consumer.default_value?(:bulk_import_id_column)
128
128
  configs[:replace_associations] = consumer.replace_associations unless consumer.default_value?(:replace_associations)
129
+ configs[:save_associations_first] = consumer.save_associations_first unless consumer.default_value?(:save_associations_first)
129
130
  configs[:active] = false if consumer.disabled
130
131
  configs[:each_message] = true unless consumer.delivery.to_s == 'inline_batch'
131
132
  configs
@@ -172,6 +173,9 @@ module Deimos
172
173
  template('karafka.rb.tt', "karafka.rb", force: true)
173
174
  rename_consumer_methods
174
175
  fix_specs
176
+ insert_into_file("Gemfile", " gem 'karafka-testing'\n", after: "group :test do\n")
177
+ # to avoid inserting multiple times, just in case there isn't a single group :test
178
+ insert_into_file("Gemfile", " gem 'karafka-testing'\n", after: /group .*test.* do\n/)
175
179
  end
176
180
 
177
181
  end
@@ -181,10 +185,18 @@ module Deimos
181
185
  def generate
182
186
  process_all_files
183
187
  say "Generation complete! You are safe to remove the existing initializer that configures Deimos.", :green
188
+ print_warnings
189
+ end
190
+
191
+ def print_warnings
184
192
  say "Note: The following settings cannot be determined by the generator:", :yellow
185
193
  say "* logger / phobos_logger (dynamic object, cannot be printed out)", :yellow
186
194
  say "* kafka.sasl.oauth_token_provider", :yellow
187
195
  say "* producers.max_buffer_size", :yellow
196
+ say "* metrics", :yellow
197
+ say "* tracer", :yellow
198
+ say "* consumers.bulk_import_id_generator", :yellow
199
+ say "* consumer.fatal_error", :yellow
188
200
  say "* consumer.backoff (only handles minimum, not maximum)", :yellow
189
201
  say "For more information, see https://github.com/flipp-oss/deimos/blob/master/docs/UPGRADING.md", :yellow
190
202
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.beta1
4
+ version: 2.0.0.pre.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-12 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf