karafka 2.0.26 → 2.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -71,18 +71,28 @@ module Karafka
71
71
  end
72
72
  end
73
73
 
74
- # @param consumer [Object] karafka consumer (normal or pro)
75
- # @return [Karafka::Processing::Result] result object which we can use to indicate
76
- # consumption processing state.
77
- def consumption(consumer)
74
+ # Is all the consumption done and finished successfully for this coordinator
75
+ def success?
78
76
  @mutex.synchronize do
79
- @consumptions[consumer] ||= Processing::Result.new
77
+ @running_jobs.zero? && @consumptions.values.all?(&:success?)
80
78
  end
81
79
  end
82
80
 
83
- # Is all the consumption done and finished successfully for this coordinator
84
- def success?
85
- @mutex.synchronize { @running_jobs.zero? && @consumptions.values.all?(&:success?) }
81
+ # Mark given consumption on consumer as successful
82
+ # @param consumer [Karafka::BaseConsumer] consumer that finished successfully
83
+ def success!(consumer)
84
+ @mutex.synchronize do
85
+ consumption(consumer).success!
86
+ end
87
+ end
88
+
89
+ # Mark given consumption on consumer as failed
90
+ # @param consumer [Karafka::BaseConsumer] consumer that failed
91
+ # @param error [StandardError] error that occurred
92
+ def failure!(consumer, error)
93
+ @mutex.synchronize do
94
+ consumption(consumer).failure!(error)
95
+ end
86
96
  end
87
97
 
88
98
  # Marks given coordinator for processing group as revoked
@@ -113,6 +123,15 @@ module Karafka
113
123
  def manual_pause?
114
124
  @pause_tracker.paused? && @manual_pause
115
125
  end
126
+
127
+ private
128
+
129
+ # @param consumer [Object] karafka consumer (normal or pro)
130
+ # @return [Karafka::Processing::Result] result object which we can use to indicate
131
+ # consumption processing state.
132
+ def consumption(consumer)
133
+ @consumptions[consumer] ||= Processing::Result.new
134
+ end
116
135
  end
117
136
  end
118
137
  end
@@ -12,9 +12,11 @@ module Karafka
12
12
 
13
13
  # @param _topic [String] topic name
14
14
  # @param messages [Array<Karafka::Messages::Message>] karafka messages
15
+ # @param _coordinator [Karafka::Processing::Coordinator] processing coordinator that will
16
+ # be used with those messages
15
17
  # @yieldparam [Integer] group id
16
18
  # @yieldparam [Array<Karafka::Messages::Message>] karafka messages
17
- def call(_topic, messages)
19
+ def call(_topic, messages, _coordinator)
18
20
  yield(0, messages)
19
21
  end
20
22
  end
@@ -31,10 +31,9 @@ module Karafka
31
31
  end
32
32
 
33
33
  # Mark job as successful
34
- coordinator.consumption(self).success!
34
+ coordinator.success!(self)
35
35
  rescue StandardError => e
36
- # If failed, mark as failed
37
- coordinator.consumption(self).failure!(e)
36
+ coordinator.failure!(self, e)
38
37
 
39
38
  # Re-raise so reported in the consumer
40
39
  raise e
@@ -16,7 +16,6 @@ module Karafka
16
16
 
17
17
  # Defaults for kafka settings, that will be overwritten only if not present already
18
18
  KAFKA_DEFAULTS = {
19
- 'client.id': 'karafka',
20
19
  # We emit the statistics by default, so all the instrumentation and web-ui work out of
21
20
  # the box, without requiring users to take any extra actions aside from enabling.
22
21
  'statistics.interval.ms': 5_000
@@ -193,6 +192,9 @@ module Karafka
193
192
  config.kafka[key] = value
194
193
  end
195
194
 
195
+ # Use Karafka client_id as kafka client id if not set
196
+ config.kafka[:'client.id'] ||= config.client_id
197
+
196
198
  return if Karafka::App.env.production?
197
199
 
198
200
  KAFKA_DEV_DEFAULTS.each do |key, value|
@@ -43,7 +43,7 @@ class KarafkaApp < Karafka::App
43
43
  routes.draw do
44
44
  <% if rails? -%>
45
45
  # Uncomment this if you use Karafka with ActiveJob
46
- # You ned to define the topic per each queue name you use
46
+ # You need to define the topic per each queue name you use
47
47
  # active_job_topic :default
48
48
  <% end -%>
49
49
  topic :example do
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.26'
6
+ VERSION = '2.0.28'
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.26
4
+ version: 2.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-01-10 00:00:00.000000000 Z
38
+ date: 2023-01-25 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.8
46
+ version: 2.0.9
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.0.0
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 2.0.8
56
+ version: 2.0.9
57
57
  - - "<"
58
58
  - !ruby/object:Gem::Version
59
59
  version: 3.0.0
@@ -77,7 +77,7 @@ dependencies:
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 2.4.7
80
+ version: 2.4.9
81
81
  - - "<"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 3.0.0
@@ -87,7 +87,7 @@ dependencies:
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 2.4.7
90
+ version: 2.4.9
91
91
  - - "<"
92
92
  - !ruby/object:Gem::Version
93
93
  version: 3.0.0
@@ -224,6 +224,7 @@ files:
224
224
  - lib/karafka/pro/encryption/setup/config.rb
225
225
  - lib/karafka/pro/loader.rb
226
226
  - lib/karafka/pro/performance_tracker.rb
227
+ - lib/karafka/pro/processing/collapser.rb
227
228
  - lib/karafka/pro/processing/coordinator.rb
228
229
  - lib/karafka/pro/processing/jobs/consume_non_blocking.rb
229
230
  - lib/karafka/pro/processing/jobs/revoked_non_blocking.rb
@@ -231,7 +232,9 @@ files:
231
232
  - lib/karafka/pro/processing/partitioner.rb
232
233
  - lib/karafka/pro/processing/scheduler.rb
233
234
  - lib/karafka/pro/processing/strategies/aj_dlq_lrj_mom.rb
235
+ - lib/karafka/pro/processing/strategies/aj_dlq_lrj_mom_vp.rb
234
236
  - lib/karafka/pro/processing/strategies/aj_dlq_mom.rb
237
+ - lib/karafka/pro/processing/strategies/aj_dlq_mom_vp.rb
235
238
  - lib/karafka/pro/processing/strategies/aj_lrj_mom.rb
236
239
  - lib/karafka/pro/processing/strategies/aj_lrj_mom_vp.rb
237
240
  - lib/karafka/pro/processing/strategies/aj_mom.rb
@@ -241,7 +244,9 @@ files:
241
244
  - lib/karafka/pro/processing/strategies/dlq.rb
242
245
  - lib/karafka/pro/processing/strategies/dlq_lrj.rb
243
246
  - lib/karafka/pro/processing/strategies/dlq_lrj_mom.rb
247
+ - lib/karafka/pro/processing/strategies/dlq_lrj_vp.rb
244
248
  - lib/karafka/pro/processing/strategies/dlq_mom.rb
249
+ - lib/karafka/pro/processing/strategies/dlq_vp.rb
245
250
  - lib/karafka/pro/processing/strategies/lrj.rb
246
251
  - lib/karafka/pro/processing/strategies/lrj_mom.rb
247
252
  - lib/karafka/pro/processing/strategies/lrj_vp.rb
@@ -343,7 +348,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
343
348
  requirements:
344
349
  - - ">="
345
350
  - !ruby/object:Gem::Version
346
- version: 2.7.0
351
+ version: '0'
347
352
  required_rubygems_version: !ruby/object:Gem::Requirement
348
353
  requirements:
349
354
  - - ">="
metadata.gz.sig CHANGED
Binary file