rimless 1.7.6 → 1.8.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: 1e635ab06b06126938fd981a6f5843fdd9fe9209dd60f3217979803c3908bd93
4
- data.tar.gz: 80e465ae3d3d5c876e1b8aee66889a652680cebfb262fc9b69b2f8329d3c410b
3
+ metadata.gz: a1deea4fa3747418c007acbf6eadb5634b97f3e5fc3ec221a78d6cf4f8c10d42
4
+ data.tar.gz: 939c0455cc813c211a2f934ee0cad879d06bc28faef5d03ab5ca7906bf5c015e
5
5
  SHA512:
6
- metadata.gz: 7aaf13e560d01488a7c1f58279149489b57250762e77ada485dc55abad6af0d02cf84a7ad2945b1fd306602f04dad15cf28c0c79f814e1a5d57d49134925df26
7
- data.tar.gz: 0f39ca294394e1ce8ba82d53e98c4f2109dd072907715a26d9a399fda1fe471c656b714751323a11ab1e7156e353dcfa53ebc26d1f1568e5408ceae73df122bf
6
+ metadata.gz: e73bffa03e3c7f5b1635ae1eeb79cc7de8748e841d7d7aa027def3b9ef62b3e068cd04c04349cf498cc55b94d13d5a7538be5c7c599707c72526c72d94a716bd
7
+ data.tar.gz: b33dd85d1d5a915483de9b2836f184ad17e4cfb180902b53e41a14ee1283683d8f7838acd51326a68758663ea27bdfc9e419b5a461d40f75758ef035911da776
data/CHANGELOG.md CHANGED
@@ -2,36 +2,48 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
- ### 1.7.6
5
+ ### 1.8.0 (14 November 2024)
6
+
7
+ * Added support for custom topic names via the `full_name:` keyword argument on
8
+ the consumer routing table (#44)
9
+ * Added support to pass a block to the routing table
10
+ (`Rimless.consumer.topics`) to add custom topic configurations (#44)
11
+
12
+ ### 1.7.7 (19 September 2024)
13
+
14
+ * Corrected the Sidekiq interchanger decoding, which is caused by an upstream
15
+ update of the karafka-sidekiq-backend gem (#43)
16
+
17
+ ### 1.7.6 (19 September 2024)
6
18
 
7
19
  * Added a monkey-patch for the constellation Karafka 1.4 and Thor 1.3,
8
20
  on Ruby >=2.7 (#42)
9
21
 
10
- ### 1.7.5
22
+ ### 1.7.5 (15 August 2024)
11
23
 
12
24
  * Just a retag of 1.7.1
13
25
 
14
- ### 1.7.4
26
+ ### 1.7.4 (15 August 2024)
15
27
 
16
28
  * Just a retag of 1.7.1
17
29
 
18
- ### 1.7.3
30
+ ### 1.7.3 (15 August 2024)
19
31
 
20
32
  * Just a retag of 1.7.1
21
33
 
22
- ### 1.7.2
34
+ ### 1.7.2 (9 August 2024)
23
35
 
24
36
  * Just a retag of 1.7.1
25
37
 
26
- ### 1.7.1
38
+ ### 1.7.1 (9 August 2024)
27
39
 
28
40
  * Added API docs building to continuous integration (#41)
29
41
 
30
- ### 1.7.0
42
+ ### 1.7.0 (8 July 2024)
31
43
 
32
44
  * Added CI tests for Rails 6.1 and 7.1 (#39)
33
45
 
34
- ### 1.6.0
46
+ ### 1.6.0 (3 July 2024)
35
47
 
36
48
  * Dropped support for Ruby <2.7 (#38)
37
49
  * Moved the schema file validation into the retry block for parallel execution
@@ -39,34 +51,34 @@
39
51
  * Updated the [Kafka Playground](./doc/kafka-playground) to the latest
40
52
  Apache Kafka (3.7) and Schema Registry (7.6) versions (#35)
41
53
 
42
- ### 1.5.1
54
+ ### 1.5.1 (26 April 2024)
43
55
 
44
56
  * Added a retry to write compiled schema files as this may fail on parallel
45
57
  execution (#33)
46
58
 
47
- ### 1.5.0
59
+ ### 1.5.0 (4 December 2023)
48
60
 
49
61
  * Do not extend the `Rimless.logger` to write to stdout by default when running
50
62
  in the `development` environment - this generates duplicated messages when
51
63
  the configured logger already writes to stdout. A new configuration was added
52
64
  `Rimless.configuration.extend_dev_logger = false` was added (#32)
53
65
 
54
- ### 1.4.2
66
+ ### 1.4.2 (12 July 2023)
55
67
 
56
68
  * Reverted to use `yield_self` instead of `then` in order to support Ruby 2.5
57
69
  as advertised (broken since #19, 1.3.0) (#31)
58
70
 
59
- ### 1.4.1
71
+ ### 1.4.1 (5 July 2023)
60
72
 
61
73
  * Moved the development dependencies from the gemspec to the Gemfile (#29)
62
74
  * Pinned Karafka gem <1.4.15 in order to suppress the
63
75
  `I_ACCEPT_CRITICAL_ERRORS_IN_KARAFKA_1_4=true` agony (#30)
64
76
 
65
- ### 1.4.0
77
+ ### 1.4.0 (24 February 2023)
66
78
 
67
79
  * Added support for Gem release automation
68
80
 
69
- ### 1.3.0
81
+ ### 1.3.0 (18 January 2023)
70
82
 
71
83
  * Bundler >= 2.3 is from now on required as minimal version (#19)
72
84
  * Dropped support for Ruby < 2.5 (#19)
@@ -74,49 +86,49 @@
74
86
  * Updated all development/runtime gems to their latest
75
87
  Ruby 2.5 compatible version (#19)
76
88
 
77
- ### 1.2.0
89
+ ### 1.2.0 (4 October 2021)
78
90
 
79
91
  * Added a `capture_kafka_messages` helper for RSpec (#12)
80
92
 
81
- ### 1.1.1
93
+ ### 1.1.1 (12 May 2021)
82
94
 
83
95
  * Corrected the GNU Make release target
84
96
 
85
- ### 1.1.0
97
+ ### 1.1.0 (23 October 2020)
86
98
 
87
99
  * Added support for Karafka `~> 1.4.0` and set is as minimum dependency version
88
100
  (#10)
89
101
 
90
- ### 1.0.4
102
+ ### 1.0.4 (14 August 2020)
91
103
 
92
104
  * Mocked WaterDrop producers in the rimless rspec helper so that tests
93
105
  won't actually talk to Kafka (#9)
94
106
 
95
- ### 1.0.3
107
+ ### 1.0.3 (14 May 2020)
96
108
 
97
109
  * Corrected broken stats when no consumer is yet defined (#8)
98
110
 
99
- ### 1.0.2
111
+ ### 1.0.2 (11 March 2020)
100
112
 
101
113
  * Only load the statistics rake task when Rails is available and the
102
114
  environment is development (instead of not production, this may cause issues
103
115
  for +canary+ or +stage+ Rails environments)
104
116
 
105
- ### 1.0.1
117
+ ### 1.0.1 (11 March 2020)
106
118
 
107
119
  * Added the missing +Karafka::Testing::RSpec::Helpers+ include to the
108
120
  RSpec configuration
109
121
 
110
- ### 1.0.0
122
+ ### 1.0.0 (11 March 2020)
111
123
 
112
124
  * Dropped support for Ruby 2.3/2.4 and added support for Rails 6.0 (#6)
113
125
  * Implemented a simple opinionated Kafka consumer setup (#7)
114
126
 
115
- ### 0.3.0
127
+ ### 0.3.0 (8 November 2019)
116
128
 
117
129
  * Upgraded the avro_turf gem (`~> 0.11.0`) (#5)
118
130
 
119
- ### 0.2.1
131
+ ### 0.2.1 (13 August 2019)
120
132
 
121
133
  * Added support for the
122
134
  [parallel_tests](https://github.com/grosser/parallel_tests) gem and
@@ -124,7 +136,7 @@
124
136
  thread. This fixes all race conditions which slow down or break user test
125
137
  suites.
126
138
 
127
- ### 0.2.0
139
+ ### 0.2.0 (5 June 2019)
128
140
 
129
141
  * Added the `Rimless.encode` (`.avro_encode`) and `Rimless.decode`
130
142
  (`.avro_decode`) helpers/shortcuts to simplify the interaction with the
@@ -143,29 +155,29 @@
143
155
  of the compiled schema directory caused previously file read errors when a
144
156
  parallel process started a recompilation.
145
157
 
146
- ### 0.1.4
158
+ ### 0.1.4 (17 April 2019)
147
159
 
148
160
  * Reconfigure (reset) the AvroTurf instance on tests to avoid caching issues
149
161
  (on failed tests the message decoding was not working which results in
150
162
  unrelated errors, instead of showing the actual test failure)
151
163
 
152
- ### 0.1.3
164
+ ### 0.1.3 (16 April 2019)
153
165
 
154
166
  * Check for unset and empty values while configuring dependencies
155
167
 
156
- ### 0.1.2
168
+ ### 0.1.2 (16 April 2019)
157
169
 
158
170
  * Skip the configuration of the AvroTurf gem in case no schema registry URL is
159
171
  configured, this allows the smooth run of Rails asset precompilations without
160
172
  full environment configurations (eg. on CI)
161
173
 
162
- ### 0.1.1
174
+ ### 0.1.1 (16 April 2019)
163
175
 
164
176
  * Skip the configuration of the WaterDrop gem in case no brokers are
165
177
  configured, this allows the smooth run of Rails asset precompilations without
166
178
  full environment configurations (eg. on CI)
167
179
 
168
- ### 0.1.0
180
+ ### 0.1.0 (16 April 2019)
169
181
 
170
182
  * The first release with support for simple Apache Avro message producing on
171
183
  Apache Kafka/Confluent Schema Registry
@@ -126,12 +126,23 @@ module Rimless
126
126
  # topics({ app: :test_app, name: :admins } => YourConsumer)
127
127
  # topics({ app: :test_app, names: %i[users admins] } => YourConsumer)
128
128
  #
129
+ # Examples:
130
+ #
131
+ # topics do
132
+ # topic('name') do
133
+ # consumer CustomConsumer
134
+ # end
135
+ # end
136
+ #
129
137
  # @param topics [Hash{Hash => Class}] the topic to consumer mapping
138
+ # @yield the given block on the routing table
130
139
  #
131
140
  # rubocop:disable Metrics/MethodLength because of the Karafka DSL
132
- def topics(topics)
141
+ def topics(topics = [], &block)
133
142
  consumer_groups.draw do
134
- consumer_group Rimless.configuration.client_id do
143
+ consumer_group(Rimless.configuration.client_id) do
144
+ instance_exec(&block) if block_given?
145
+
135
146
  topics.each do |topic_parts, dest_consumer|
136
147
  Rimless.consumer.topic_names(topic_parts).each do |topic_name|
137
148
  topic(topic_name) do
@@ -19,14 +19,21 @@ module Rimless
19
19
  # Rimless.topic(:users, app: 'test-api')
20
20
  # @example Mix and match
21
21
  # Rimless.topic(name: 'test', app: :fancy_app)
22
+ # @example Full name - use as is
23
+ # Rimless.topic(full_name: 'my.custom.topic.name')
22
24
  #
23
- # rubocop:disable Metrics/AbcSize because of the usage flexibility
25
+ # rubocop:disable Metrics/MethodLength because of the usage flexibility
26
+ # rubocop:disable Metrics/AbcSize dito
24
27
  # rubocop:disable Metrics/CyclomaticComplexity dito
28
+ # rubocop:disable Metrics/PerceivedComplexity dito
25
29
  def topic(*args)
26
30
  opts = args.last
27
31
  name = args.first if [String, Symbol].member?(args.first.class)
28
32
 
29
33
  if opts.is_a?(Hash)
34
+ # When we got a full name, we use it as is
35
+ return opts[:full_name] if opts.key? :full_name
36
+
30
37
  name = opts[:name] if opts.key?(:name)
31
38
  app = opts[:app] if opts.key?(:app)
32
39
  end
@@ -38,8 +45,10 @@ module Rimless
38
45
 
39
46
  "#{Rimless.topic_prefix(app)}#{name}".tr('_', '-')
40
47
  end
48
+ # rubocop:enable Metrics/MethodLength
41
49
  # rubocop:enable Metrics/AbcSize
42
50
  # rubocop:enable Metrics/CyclomaticComplexity
51
+ # rubocop:enable Metrics/PerceivedComplexity
43
52
 
44
53
  # Send a single message to Apache Kafka. The data is encoded according to
45
54
  # the given Apache Avro schema. The destination Kafka topic may be a
@@ -11,7 +11,8 @@ module Rimless
11
11
  # Encode a binary Apache Kafka message(s) so they can be passed to the
12
12
  # Sidekiq +Rimless::ConsumerJob+.
13
13
  #
14
- # @param params_batch [Mixed] the raw message(s) to encode
14
+ # @param params_batch [Karafka::Params::ParamsBatch] the karafka params
15
+ # batch object
15
16
  # @return [String] the marshaled+base64 encoded data
16
17
  def encode(params_batch)
17
18
  Base64.encode64(Marshal.dump(super))
@@ -21,9 +22,9 @@ module Rimless
21
22
  # the Sidekiq +Rimless::ConsumerJob+.
22
23
  #
23
24
  # @param params_string [String] the marshaled+base64 encoded data
24
- # @return [Mixed] the unmarshaled+base64 decoded data
25
- def decode(params_string)
26
- Marshal.load(Base64.decode64(super)).map(&:stringify_keys)
25
+ # @return [Array<Hash>] the unmarshaled+base64 decoded data
26
+ def decode(params_batch)
27
+ super(Marshal.load(Base64.decode64(params_batch))).map(&:stringify_keys)
27
28
  end
28
29
  end
29
30
  # rubocop:enable Security/MarshalLoad
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module Rimless
5
5
  # The version of the +rimless+ gem
6
- VERSION = '1.7.6'
6
+ VERSION = '1.8.0'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
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.7.6
4
+ version: 1.8.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: 2024-09-19 00:00:00.000000000 Z
11
+ date: 2024-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport