deimos-ruby 2.0.0.pre.alpha7 → 2.0.0.pre.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deimos/active_record_consume/batch_consumption.rb +1 -1
- data/lib/deimos/config/configuration.rb +1 -1
- data/lib/deimos/ext/producer_middleware.rb +1 -1
- data/lib/deimos/ext/routing_defaults.rb +1 -1
- data/lib/deimos/logging.rb +6 -1
- data/lib/deimos/version.rb +1 -1
- data/lib/generators/deimos/v2/templates/karafka.rb.tt +3 -2
- data/lib/generators/deimos/v2_generator.rb +15 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ac705b5012248d24a0355f4fbb8ad3e66ed57b3ee08329aea148b57fe65a27
|
4
|
+
data.tar.gz: d5e22a7400ed5471815ea8b14a86fe3253ea870c024c4c7ecfcacc5f80042085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c6f493835cff025892932d7b8d6f0f2ad61f2d26eda7523fe2df217916187512cec3c3e5e21c08eaeaedfc2ede260acee03e0341ee844e13f28974a79de9913
|
7
|
+
data.tar.gz: d74bad2d818f09bc81577c06eef13071bbe52d0f3bddec7b8067fa5e360200db96af50d4d1e7f477390d2dca4ba66ae9101ce281f312d6c6acdfedbd5b8efa0d
|
@@ -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'
|
@@ -10,7 +10,7 @@ module Deimos
|
|
10
10
|
message: message
|
11
11
|
) do
|
12
12
|
config = Deimos.karafka_config_for(topic: message[:topic])
|
13
|
-
return message if config.nil?
|
13
|
+
return message if config.nil? || config.schema.nil?
|
14
14
|
return if message[:payload] && !message[:payload].is_a?(Hash) && !message[:payload].is_a?(SchemaClass::Record)
|
15
15
|
|
16
16
|
m = Deimos::Message.new(message[:payload].to_h,
|
data/lib/deimos/logging.rb
CHANGED
@@ -42,7 +42,12 @@ module Deimos
|
|
42
42
|
case payload_log
|
43
43
|
when :keys
|
44
44
|
keys = messages.map do |m|
|
45
|
-
m.respond_to?(:payload)
|
45
|
+
if m.respond_to?(:payload)
|
46
|
+
m.key || m.payload['message_id']
|
47
|
+
elsif m
|
48
|
+
payload = m[:payload]&.with_indifferent_access
|
49
|
+
m[:key] || m[:payload_key] || payload[:payload_key] || payload[:message_id]
|
50
|
+
end
|
46
51
|
end
|
47
52
|
log_message.merge!(
|
48
53
|
payload_keys: keys
|
data/lib/deimos/version.rb
CHANGED
@@ -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.
|
84
|
-
configs["ssl.certificate.
|
85
|
-
configs["ssl.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.
|
4
|
+
version: 2.0.0.pre.beta2
|
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-
|
11
|
+
date: 2024-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro_turf
|