deimos-ruby 2.0.11 → 2.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a8797368d0ba5dca5fd5969f2b338cafe78a2135a8b6debef6a9819ff0a450a
4
- data.tar.gz: bacfb39390ca74aed8e25e373ad972f9c835954d86b39f632fc041319758193b
3
+ metadata.gz: 0c18442a9ba85a0b6de4c3cdaee151727d7e7ba9ca70de8129b08a91ad1a100c
4
+ data.tar.gz: 7db213f9a31a8775f6f23fd10098d284df59f5dbf4b040d0719b9fa10f5af6e6
5
5
  SHA512:
6
- metadata.gz: 28decafcc8e7f0d9432f89e13cdb672aa1574c598df3c0f4e61bcc50859ed214f9b9097e5494b75a172ccaa1875656bc87c51149b7e7809db531c941efd02d89
7
- data.tar.gz: 0ce15ac9fc75d39fac294352a4b0cc454df35ed738d9f664e1a607df30f810682bdf7af9116e053e85e181f3b27f801138660c84c4b9ecdbfec14d3f013ea321
6
+ metadata.gz: 532e1eed51b376e568c1e7e9b424a65a29a7e339e8db91e3f3761328ff826e3ad45a8c12bddbb4155707610df3ab36bf90e1acfe6411b6829be6fe8e45453e75
7
+ data.tar.gz: 29ca80e081b8c0699ee8b132c31d7ab27eb91f63dca808a03f8c7e3905a70a7f520964abc0631995b033c7bfc72d3581dd7d5dacd93d234b970ebbc92bd99837
data/CHANGELOG.md CHANGED
@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
- ## 2.0.11 - 2025-05-22
10
+ ## 2.0.13 - 2025-05-26
11
+
12
+ - Fix: Outbox producer would crash if no Deimos producer was defined for the topic.
13
+
14
+ ## 2.0.12 - 2025-05-22
11
15
 
12
16
  - Fix: Allow for hot reloading of producer classes without crashing.
13
17
 
@@ -9,9 +9,10 @@ module Deimos
9
9
  producer: self,
10
10
  message: message
11
11
  ) do
12
+ return message if message.delete(:already_encoded)
13
+
12
14
  config = Deimos.karafka_config_for(topic: message[:topic])
13
15
  return message if config.nil? || config.schema.nil?
14
- return message if message.delete(:already_encoded)
15
16
  return if message[:payload] && !message[:payload].is_a?(Hash) && !message[:payload].is_a?(SchemaClass::Record)
16
17
 
17
18
  m = Deimos::Message.new(message[:payload].to_h,
@@ -98,6 +98,8 @@ module Deimos
98
98
  message_key = Deimos::TestHelpers.normalize_message(key)
99
99
  hash_matcher = RSpec::Matchers::BuiltIn::Match.new(message)
100
100
  Deimos::TestHelpers.sent_messages.any? do |m|
101
+ return m[:payload] == message if message.is_a?(String)
102
+
101
103
  message.delete(:payload_key) if message.respond_to?(:[]) && message[:payload_key].nil?
102
104
  m[:payload].delete(:payload_key) if m.respond_to?(:[]) && m[:payload]&.respond_to?(:[]) && m[:payload][:payload_key].nil?
103
105
  hash_matcher.send(:match, message, m[:payload]) &&
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '2.0.11'
4
+ VERSION = '2.0.13'
5
5
  end
data/lib/deimos.rb CHANGED
@@ -107,6 +107,8 @@ module Deimos
107
107
  topic = topic.sub(Deimos.config.producers.topic_prefix, '')
108
108
  end
109
109
  config = karafka_config_for(topic: topic)
110
+ return message unless config
111
+
110
112
  message[:payload] = config.deserializers[:payload].decode_message_hash(message[:payload])
111
113
  if message[:key] && config.deserializers[:key].respond_to?(:decode_message_hash)
112
114
  message[:key] = config.deserializers[:key].decode_message_hash(message[:key])
@@ -340,6 +340,17 @@ each_db_config(Deimos::Utils::OutboxProducer) do
340
340
  end
341
341
 
342
342
  example 'Full integration test' do
343
+ Deimos::KafkaMessage.create!(topic: "topic1",
344
+ message: "mess1",
345
+ partition_key: "key1")
346
+ producer.process_next_messages
347
+ expect(Deimos::KafkaTopicInfo.count).to eq(1)
348
+ expect(Deimos::KafkaTopicInfo.first.topic).to eq('topic1')
349
+ expect(Deimos::KafkaMessage.count).to eq(0)
350
+ expect('topic1').to have_sent('mess1')
351
+ end
352
+
353
+ example 'Integration test - batching' do
343
354
  (1..4).each do |i|
344
355
  (1..2).each do |j|
345
356
  Deimos::KafkaMessage.create!(topic: "topic#{j}",
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.11
4
+ version: 2.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-22 00:00:00.000000000 Z
11
+ date: 2025-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf