rimless 1.0.4 → 1.1.0

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: aa04c0230d9defc00a64eaebabbad4d06dd22c6432316d5fd7baab0e64527cdd
4
- data.tar.gz: 311d8c3b112b6f628d66f6d59eb3b8f9298bd56b5c8f7d973e456668dab34dbc
3
+ metadata.gz: f8731817c3b1148a4a9c5954f89cbc2a6a1f5c9e7023137be662d2405260cfc0
4
+ data.tar.gz: 731e88cf5b51713d89178dd7e17b5ec180ed3644f7359a6dc70994d2f2dfd5f5
5
5
  SHA512:
6
- metadata.gz: 9a93590a36bdb88097de37ce3d1dc0cd93d8f763a860f7cdac5d796764ecf8a74aebdc1db5a6e0642cde7cc108796226f9fd0e7ba02be1d768b30632829eec26
7
- data.tar.gz: d8893ee4ce93e8682d55bec99645f401953b3fe92daeb5a7d607e3ca76ce1f295b7af469029ec5818a0c71987fcd32b151563e1bbc389a29ef4d9c3cda65ee97
6
+ metadata.gz: 470445e7954d1c51c815c98988a87fe2e8b520b53ccdc36cd77ae8380ed0756ec89c181f338e646cd5f472b2cf9fd249b259d1f34713f7ec6e71a0486bd4d27b
7
+ data.tar.gz: bb8c86c2aece00aa3c6e38ebb96847bf33059f60cab1e163d92cc8ae8fb077bb000423b977243214df5c3d45691e3bad48a62ebb811b4783d6f1a4688abf256e
@@ -1,3 +1,8 @@
1
+ ### 1.1.0
2
+
3
+ * Added support for Karafka `~> 1.4.0` and set is as minimum dependency version
4
+ (#10)
5
+
1
6
  ### 1.0.4
2
7
 
3
8
  * Mocked WaterDrop producers in the rimless rspec helper so that tests
data/Makefile CHANGED
@@ -85,7 +85,11 @@ update: install
85
85
  @$(MKDIR) -p $(VENDOR_DIR)
86
86
  @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) update)
87
87
 
88
- test: #install
88
+ test: \
89
+ test-specs \
90
+ test-style
91
+
92
+ test-specs:
89
93
  # Run the whole test suite
90
94
  @$(call run-shell,$(BUNDLE) exec $(RAKE))
91
95
 
@@ -131,7 +131,7 @@ module Rimless
131
131
  topic(topic_name) do
132
132
  consumer dest_consumer
133
133
  worker Rimless::ConsumerJob
134
- interchanger Rimless::Karafka::Base64Interchanger
134
+ interchanger Rimless::Karafka::Base64Interchanger.new
135
135
  end
136
136
  end
137
137
  end
@@ -6,15 +6,19 @@ module Rimless
6
6
  class AvroDeserializer
7
7
  # Deserialize an Apache Avro encoded Apache Kafka message.
8
8
  #
9
- # @param message [String] the binary blob to deserialize
9
+ # @param params [Karafka::Params::Params] the Karafka message parameters
10
10
  # @return [Hash{Symbol => Mixed}] the deserialized Apache Avro message
11
- def call(message)
11
+ def call(params)
12
+ # When the Kafka message does not have a payload, we won't fail.
13
+ # This is for Kafka users which use log compaction with a nil payload.
14
+ return if params.raw_payload.nil?
15
+
12
16
  # We use sparsed hashes inside of Apache Avro messages for schema-less
13
17
  # blobs of data, such as loosely structured metadata blobs. Thats a
14
18
  # somewhat bad idea on strictly typed and defined messages, but their
15
19
  # occurence should be rare.
16
20
  Rimless
17
- .decode(message.payload)
21
+ .decode(params.raw_payload)
18
22
  .yield_self { |data| Sparsify(data, sparse_array: true) }
19
23
  .yield_self { |data| data.transform_keys { |key| key.delete('\\') } }
20
24
  .yield_self { |data| Unsparsify(data, sparse_array: true) }
@@ -7,14 +7,14 @@ module Rimless
7
7
  #
8
8
  # rubocop:disable Security/MarshalLoad because we encode/decode the
9
9
  # messages in our own controlled context
10
- class Base64Interchanger
10
+ class Base64Interchanger < ::Karafka::Interchanger
11
11
  # Encode a binary Apache Kafka message(s) so they can be passed to the
12
12
  # Sidekiq +Rimless::ConsumerJob+.
13
13
  #
14
14
  # @param params_batch [Mixed] the raw message(s) to encode
15
15
  # @return [String] the marshaled+base64 encoded data
16
- def self.encode(params_batch)
17
- Base64.encode64(Marshal.dump(params_batch.to_a))
16
+ def encode(params_batch)
17
+ Base64.encode64(Marshal.dump(super))
18
18
  end
19
19
 
20
20
  # Decode the binary Apache Kafka message(s) so they can be processed by
@@ -22,8 +22,8 @@ module Rimless
22
22
  #
23
23
  # @param params_string [String] the marshaled+base64 encoded data
24
24
  # @return [Mixed] the unmarshaled+base64 decoded data
25
- def self.decode(params_string)
26
- Marshal.load(Base64.decode64(params_string))
25
+ def decode(params_string)
26
+ Marshal.load(Base64.decode64(super)).map(&:stringify_keys)
27
27
  end
28
28
  end
29
29
  # rubocop:enable Security/MarshalLoad
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Rimless
4
4
  # The version of the +rimless+ gem
5
- VERSION = '1.0.4'
5
+ VERSION = '1.1.0'
6
6
  end
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_runtime_dependency 'activesupport', '>= 4.2.0'
27
27
  spec.add_runtime_dependency 'avro_turf', '~> 0.11.0'
28
- spec.add_runtime_dependency 'karafka', '~> 1.3'
29
- spec.add_runtime_dependency 'karafka-sidekiq-backend', '~> 1.3'
30
- spec.add_runtime_dependency 'karafka-testing', '~> 1.3'
28
+ spec.add_runtime_dependency 'karafka', '~> 1.4'
29
+ spec.add_runtime_dependency 'karafka-sidekiq-backend', '~> 1.4'
30
+ spec.add_runtime_dependency 'karafka-testing', '~> 1.4'
31
31
  spec.add_runtime_dependency 'sinatra'
32
32
  spec.add_runtime_dependency 'sparsify', '~> 1.1'
33
33
  spec.add_runtime_dependency 'waterdrop', '~> 1.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rimless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-14 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '1.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '1.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: karafka-sidekiq-backend
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: '1.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: karafka-testing
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.3'
75
+ version: '1.4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.3'
82
+ version: '1.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sinatra
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -433,7 +433,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
433
433
  - !ruby/object:Gem::Version
434
434
  version: '0'
435
435
  requirements: []
436
- rubygems_version: 3.1.3
436
+ rubygems_version: 3.1.4
437
437
  signing_key:
438
438
  specification_version: 4
439
439
  summary: A bundle of opinionated Apache Kafka / Confluent Schema Registry helpers.