karafka 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +24 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +41 -46
- data/README.md +7 -5
- data/lib/karafka/cli/install.rb +1 -1
- data/lib/karafka/cli/server.rb +8 -8
- data/lib/karafka/connection/api_adapter.rb +10 -12
- data/lib/karafka/connection/builder.rb +6 -1
- data/lib/karafka/connection/client.rb +6 -4
- data/lib/karafka/instrumentation/logger.rb +1 -1
- data/lib/karafka/server.rb +1 -1
- data/lib/karafka/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fae4fb99cb42515602d9f27a6d7a5bd7485e4e0b40868a6856766ebe7b50083
|
4
|
+
data.tar.gz: b82635f328ba711f836da733dd0ec5ed415446d3209918a20f7b6f42ff1e1ac2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f90e7c6757cd517649c0021f759db091c050899c8a7846d022fa58e117db61cb5a3f6ee640b452f43017e0b504b0ba6a3b075886b266438daf1098d0fa2bc48d
|
7
|
+
data.tar.gz: 7ab841ff7269992e90a17a88159baa9be67ab35866f8d174a434bd6efbecceb1521bbf142b6c9ebb37cabbea8a125e49b60fde3844b2a0e6ce3b62ef941b6a75
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
name: ci
|
2
2
|
|
3
3
|
on:
|
4
|
+
pull_request:
|
4
5
|
push:
|
5
6
|
schedule:
|
6
7
|
- cron: '0 1 * * *'
|
@@ -8,15 +9,17 @@ on:
|
|
8
9
|
jobs:
|
9
10
|
specs:
|
10
11
|
runs-on: ubuntu-latest
|
12
|
+
needs: diffend
|
11
13
|
strategy:
|
12
14
|
fail-fast: false
|
13
15
|
matrix:
|
14
16
|
ruby:
|
17
|
+
- '3.0'
|
15
18
|
- '2.7'
|
16
19
|
- '2.6'
|
17
20
|
- '2.5'
|
18
21
|
include:
|
19
|
-
- ruby: '
|
22
|
+
- ruby: '3.0'
|
20
23
|
coverage: 'true'
|
21
24
|
steps:
|
22
25
|
- uses: actions/checkout@v2
|
@@ -40,6 +43,26 @@ jobs:
|
|
40
43
|
env:
|
41
44
|
GITHUB_COVERAGE: ${{matrix.coverage}}
|
42
45
|
run: bundle exec rspec
|
46
|
+
|
47
|
+
diffend:
|
48
|
+
runs-on: ubuntu-latest
|
49
|
+
strategy:
|
50
|
+
fail-fast: false
|
51
|
+
steps:
|
52
|
+
- uses: actions/checkout@v2
|
53
|
+
with:
|
54
|
+
fetch-depth: 0
|
55
|
+
- name: Set up Ruby
|
56
|
+
uses: ruby/setup-ruby@v1
|
57
|
+
with:
|
58
|
+
ruby-version: 3.0
|
59
|
+
- name: Install latest bundler
|
60
|
+
run: gem install bundler --no-document
|
61
|
+
- name: Install Diffend plugin
|
62
|
+
run: bundle plugin install diffend
|
63
|
+
- name: Bundle Secure
|
64
|
+
run: bundle secure
|
65
|
+
|
43
66
|
coditsu:
|
44
67
|
runs-on: ubuntu-latest
|
45
68
|
strategy:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Karafka framework changelog
|
2
2
|
|
3
|
+
## 1.4.3 (2021-03-24)
|
4
|
+
- Fixes for Ruby 3.0 compatibility
|
5
|
+
|
6
|
+
## 1.4.2 (2021-02-16)
|
7
|
+
- Rescue Errno::EROFS in ensure_dir_exists (unasuke)
|
8
|
+
|
3
9
|
## 1.4.1 (2020-12-04)
|
4
10
|
- Return non-zero exit code when printing usage
|
5
11
|
- Add support for :assignment_strategy for consumers
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka (1.4.
|
4
|
+
karafka (1.4.3)
|
5
5
|
dry-configurable (~> 0.8)
|
6
6
|
dry-inflector (~> 0.1)
|
7
7
|
dry-monitor (~> 0.3)
|
@@ -17,29 +17,28 @@ PATH
|
|
17
17
|
GEM
|
18
18
|
remote: https://rubygems.org/
|
19
19
|
specs:
|
20
|
-
activesupport (6.
|
20
|
+
activesupport (6.1.3)
|
21
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
-
i18n (>=
|
23
|
-
minitest (
|
24
|
-
tzinfo (~>
|
25
|
-
zeitwerk (~> 2.
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
minitest (>= 5.1)
|
24
|
+
tzinfo (~> 2.0)
|
25
|
+
zeitwerk (~> 2.3)
|
26
26
|
byebug (11.1.3)
|
27
|
-
concurrent-ruby (1.1.
|
28
|
-
delivery_boy (1.0
|
29
|
-
king_konf (~> 0
|
27
|
+
concurrent-ruby (1.1.8)
|
28
|
+
delivery_boy (1.1.0)
|
29
|
+
king_konf (~> 1.0)
|
30
30
|
ruby-kafka (~> 1.0)
|
31
31
|
diff-lcs (1.4.4)
|
32
|
-
digest-crc (0.6.
|
33
|
-
rake (
|
34
|
-
docile (1.3.
|
35
|
-
dry-configurable (0.
|
32
|
+
digest-crc (0.6.3)
|
33
|
+
rake (>= 12.0.0, < 14.0.0)
|
34
|
+
docile (1.3.5)
|
35
|
+
dry-configurable (0.12.1)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
dry-core (~> 0.
|
38
|
-
dry-equalizer (~> 0.2)
|
37
|
+
dry-core (~> 0.5, >= 0.5.0)
|
39
38
|
dry-container (0.7.2)
|
40
39
|
concurrent-ruby (~> 1.0)
|
41
40
|
dry-configurable (~> 0.1, >= 0.1.3)
|
42
|
-
dry-core (0.
|
41
|
+
dry-core (0.5.0)
|
43
42
|
concurrent-ruby (~> 1.0)
|
44
43
|
dry-equalizer (0.3.0)
|
45
44
|
dry-events (0.2.0)
|
@@ -48,31 +47,28 @@ GEM
|
|
48
47
|
dry-equalizer (~> 0.2)
|
49
48
|
dry-inflector (0.2.0)
|
50
49
|
dry-initializer (3.0.4)
|
51
|
-
dry-logic (1.0
|
50
|
+
dry-logic (1.1.0)
|
52
51
|
concurrent-ruby (~> 1.0)
|
53
|
-
dry-core (~> 0.
|
54
|
-
dry-equalizer (~> 0.2)
|
52
|
+
dry-core (~> 0.5, >= 0.5)
|
55
53
|
dry-monitor (0.3.2)
|
56
54
|
dry-configurable (~> 0.5)
|
57
55
|
dry-core (~> 0.4)
|
58
56
|
dry-equalizer (~> 0.2)
|
59
57
|
dry-events (~> 0.2)
|
60
|
-
dry-schema (1.
|
58
|
+
dry-schema (1.6.1)
|
61
59
|
concurrent-ruby (~> 1.0)
|
62
60
|
dry-configurable (~> 0.8, >= 0.8.3)
|
63
|
-
dry-core (~> 0.
|
64
|
-
dry-equalizer (~> 0.2)
|
61
|
+
dry-core (~> 0.5, >= 0.5)
|
65
62
|
dry-initializer (~> 3.0)
|
66
63
|
dry-logic (~> 1.0)
|
67
|
-
dry-types (~> 1.
|
68
|
-
dry-types (1.
|
64
|
+
dry-types (~> 1.5)
|
65
|
+
dry-types (1.5.1)
|
69
66
|
concurrent-ruby (~> 1.0)
|
70
67
|
dry-container (~> 0.3)
|
71
|
-
dry-core (~> 0.
|
72
|
-
dry-equalizer (~> 0.3)
|
68
|
+
dry-core (~> 0.5, >= 0.5)
|
73
69
|
dry-inflector (~> 0.1, >= 0.1.2)
|
74
70
|
dry-logic (~> 1.0, >= 1.0.2)
|
75
|
-
dry-validation (1.
|
71
|
+
dry-validation (1.6.0)
|
76
72
|
concurrent-ruby (~> 1.0)
|
77
73
|
dry-container (~> 0.7, >= 0.7.1)
|
78
74
|
dry-core (~> 0.4)
|
@@ -83,42 +79,41 @@ GEM
|
|
83
79
|
dry-inflector (~> 0.1)
|
84
80
|
factory_bot (6.1.0)
|
85
81
|
activesupport (>= 5.0.0)
|
86
|
-
i18n (1.8.
|
82
|
+
i18n (1.8.9)
|
87
83
|
concurrent-ruby (~> 1.0)
|
88
|
-
io-console (0.5.
|
89
|
-
irb (1.
|
84
|
+
io-console (0.5.9)
|
85
|
+
irb (1.3.4)
|
90
86
|
reline (>= 0.1.5)
|
91
|
-
king_konf (0.
|
92
|
-
minitest (5.14.
|
93
|
-
rake (13.0.
|
94
|
-
reline (0.
|
87
|
+
king_konf (1.0.0)
|
88
|
+
minitest (5.14.4)
|
89
|
+
rake (13.0.3)
|
90
|
+
reline (0.2.4)
|
95
91
|
io-console (~> 0.5)
|
96
92
|
rspec (3.10.0)
|
97
93
|
rspec-core (~> 3.10.0)
|
98
94
|
rspec-expectations (~> 3.10.0)
|
99
95
|
rspec-mocks (~> 3.10.0)
|
100
|
-
rspec-core (3.10.
|
96
|
+
rspec-core (3.10.1)
|
101
97
|
rspec-support (~> 3.10.0)
|
102
|
-
rspec-expectations (3.10.
|
98
|
+
rspec-expectations (3.10.1)
|
103
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
104
100
|
rspec-support (~> 3.10.0)
|
105
|
-
rspec-mocks (3.10.
|
101
|
+
rspec-mocks (3.10.2)
|
106
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
107
103
|
rspec-support (~> 3.10.0)
|
108
|
-
rspec-support (3.10.
|
104
|
+
rspec-support (3.10.2)
|
109
105
|
ruby-kafka (1.3.0)
|
110
106
|
digest-crc
|
111
|
-
simplecov (0.
|
107
|
+
simplecov (0.21.2)
|
112
108
|
docile (~> 1.1)
|
113
109
|
simplecov-html (~> 0.11)
|
114
110
|
simplecov_json_formatter (~> 0.1)
|
115
111
|
simplecov-html (0.12.3)
|
116
112
|
simplecov_json_formatter (0.1.2)
|
117
|
-
thor (1.0
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
waterdrop (1.4.0)
|
113
|
+
thor (1.1.0)
|
114
|
+
tzinfo (2.0.4)
|
115
|
+
concurrent-ruby (~> 1.0)
|
116
|
+
waterdrop (1.4.1)
|
122
117
|
delivery_boy (>= 0.2, < 2.x)
|
123
118
|
dry-configurable (~> 0.8)
|
124
119
|
dry-monitor (~> 0.3)
|
@@ -128,7 +123,7 @@ GEM
|
|
128
123
|
zeitwerk (2.4.2)
|
129
124
|
|
130
125
|
PLATFORMS
|
131
|
-
|
126
|
+
x86_64-linux
|
132
127
|
|
133
128
|
DEPENDENCIES
|
134
129
|
byebug
|
@@ -138,4 +133,4 @@ DEPENDENCIES
|
|
138
133
|
simplecov
|
139
134
|
|
140
135
|
BUNDLED WITH
|
141
|
-
2.
|
136
|
+
2.2.15
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
![karafka logo](https://raw.githubusercontent.com/karafka/misc/master/logo/karafka_logotype_transparent2.png)
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/karafka/karafka/actions/workflows/ci.yml/badge.svg)](https://github.com/karafka/karafka/actions/workflows/ci.yml)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/karafka.svg)](http://badge.fury.io/rb/karafka)
|
5
|
+
[![Join the chat at https://gitter.im/karafka/karafka](https://badges.gitter.im/karafka/karafka.svg)](https://gitter.im/karafka/karafka)
|
4
6
|
|
5
|
-
**Note**:
|
6
|
-
|
7
|
-
|
7
|
+
**Note**: We're finishing the new Karafka `2.0` but for now, please use `1.4`. All the documentation presented here refers to `1.4`
|
8
|
+
..
|
9
|
+
Documentation presented here refers to Karafka `1.4`.
|
8
10
|
|
9
11
|
## About Karafka
|
10
12
|
|
@@ -72,7 +74,7 @@ Karafka framework and Karafka team are __not__ related to Kafka streaming servic
|
|
72
74
|
## References
|
73
75
|
|
74
76
|
* [Karafka framework](https://github.com/karafka/karafka)
|
75
|
-
* [Karafka
|
77
|
+
* [Karafka GitHub Actions](https://github.com/karafka/karafka/actions)
|
76
78
|
* [Karafka Coditsu](https://app.coditsu.io/karafka/repositories/karafka)
|
77
79
|
|
78
80
|
## Note on contributions
|
data/lib/karafka/cli/install.rb
CHANGED
data/lib/karafka/cli/server.rb
CHANGED
@@ -31,14 +31,6 @@ module Karafka
|
|
31
31
|
# part of the topics
|
32
32
|
Karafka::Server.consumer_groups = cli.options[:consumer_groups]
|
33
33
|
|
34
|
-
# Remove pidfile on stop, just before the server instance is going to be GCed
|
35
|
-
# We want to delay the moment in which the pidfile is removed as much as we can,
|
36
|
-
# so instead of removing it after the server stops running, we rely on the gc moment
|
37
|
-
# when this object gets removed (it is a bit later), so it is closer to the actual
|
38
|
-
# system process end. We do that, so monitoring and deployment tools that rely on a pid
|
39
|
-
# won't alarm or start new system process up until the current one is finished
|
40
|
-
ObjectSpace.define_finalizer(self, proc { send(:clean) })
|
41
|
-
|
42
34
|
Karafka::Server.run
|
43
35
|
end
|
44
36
|
|
@@ -60,6 +52,14 @@ module Karafka
|
|
60
52
|
cli.options[:pid],
|
61
53
|
'w'
|
62
54
|
) { |file| file.write(::Process.pid) }
|
55
|
+
|
56
|
+
# Remove pidfile on stop, just before the server instance is going to be GCed
|
57
|
+
# We want to delay the moment in which the pidfile is removed as much as we can,
|
58
|
+
# so instead of removing it after the server stops running, we rely on the gc moment
|
59
|
+
# when this object gets removed (it is a bit later), so it is closer to the actual
|
60
|
+
# system process end. We do that, so monitoring and deployment tools that rely on a pid
|
61
|
+
# won't alarm or start new system process up until the current one is finished
|
62
|
+
ObjectSpace.define_finalizer(self, proc { send(:clean) })
|
63
63
|
end
|
64
64
|
|
65
65
|
# Removes a pidfile (if exist)
|
@@ -48,30 +48,28 @@ module Karafka
|
|
48
48
|
|
49
49
|
# Builds all the configuration settings for kafka#consumer method
|
50
50
|
# @param consumer_group [Karafka::Routing::ConsumerGroup] consumer group details
|
51
|
-
# @return [
|
51
|
+
# @return [Hash] all the consumer keyword arguments including hash with all
|
52
52
|
# the settings required by Kafka#consumer
|
53
53
|
def consumer(consumer_group)
|
54
54
|
settings = { group_id: consumer_group.id }
|
55
55
|
settings = fetch_for(:consumer, consumer_group, settings)
|
56
|
-
|
56
|
+
sanitize(settings)
|
57
57
|
end
|
58
58
|
|
59
59
|
# Builds all the configuration settings for kafka consumer consume_each_batch and
|
60
60
|
# consume_each_message methods
|
61
61
|
# @param consumer_group [Karafka::Routing::ConsumerGroup] consumer group details
|
62
|
-
# @return [
|
63
|
-
# including
|
62
|
+
# @return [Hash] hash with all the arguments required by consuming method
|
63
|
+
# including all the settings required by
|
64
64
|
# Kafka::Consumer#consume_each_message and Kafka::Consumer#consume_each_batch method
|
65
65
|
def consumption(consumer_group)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
automatically_mark_as_processed: consumer_group.automatically_mark_as_consumed
|
72
|
-
)
|
66
|
+
sanitize(
|
67
|
+
fetch_for(
|
68
|
+
:consumption,
|
69
|
+
consumer_group,
|
70
|
+
automatically_mark_as_processed: consumer_group.automatically_mark_as_consumed
|
73
71
|
)
|
74
|
-
|
72
|
+
)
|
75
73
|
end
|
76
74
|
|
77
75
|
# Builds all the configuration settings for kafka consumer#subscribe method
|
@@ -10,7 +10,12 @@ module Karafka
|
|
10
10
|
# to have a new Kafka client
|
11
11
|
# @return [::Kafka::Client] returns a Kafka client
|
12
12
|
def call(consumer_group)
|
13
|
-
|
13
|
+
settings = ApiAdapter.client(consumer_group)
|
14
|
+
|
15
|
+
Kafka.new(
|
16
|
+
settings[0],
|
17
|
+
**settings[1]
|
18
|
+
)
|
14
19
|
end
|
15
20
|
end
|
16
21
|
end
|
@@ -33,9 +33,9 @@ module Karafka
|
|
33
33
|
settings = ApiAdapter.consumption(consumer_group)
|
34
34
|
|
35
35
|
if consumer_group.batch_fetching
|
36
|
-
kafka_consumer.each_batch(
|
36
|
+
kafka_consumer.each_batch(**settings) { |batch| yield(batch, :batch) }
|
37
37
|
else
|
38
|
-
kafka_consumer.each_message(
|
38
|
+
kafka_consumer.each_message(**settings) { |message| yield(message, :message) }
|
39
39
|
end
|
40
40
|
# @note We catch only the processing errors as any other are considered critical (exceptions)
|
41
41
|
# and should require a client restart with a backoff
|
@@ -98,10 +98,12 @@ module Karafka
|
|
98
98
|
# @note We don't cache the connection internally because we cache kafka_consumer that uses
|
99
99
|
# kafka client object instance
|
100
100
|
@kafka_consumer ||= Builder.call(consumer_group).consumer(
|
101
|
-
|
101
|
+
**ApiAdapter.consumer(consumer_group)
|
102
102
|
).tap do |consumer|
|
103
103
|
consumer_group.topics.each do |topic|
|
104
|
-
|
104
|
+
settings = ApiAdapter.subscribe(topic)
|
105
|
+
|
106
|
+
consumer.subscribe(settings[0], **settings[1])
|
105
107
|
end
|
106
108
|
end
|
107
109
|
rescue Kafka::ConnectionError
|
data/lib/karafka/server.rb
CHANGED
@@ -58,7 +58,7 @@ module Karafka
|
|
58
58
|
def stop_supervised
|
59
59
|
Karafka::App.stop!
|
60
60
|
|
61
|
-
#
|
61
|
+
# See https://github.com/dry-rb/dry-configurable/issues/93
|
62
62
|
timeout = Thread.new { Karafka::App.config.shutdown_timeout }.join.value
|
63
63
|
|
64
64
|
# We check from time to time (for the timeout period) if all the threads finished
|
data/lib/karafka/version.rb
CHANGED
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: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
2DND//YJUikn1zwbz1kT70XmHd97B4Eytpln7K+M1u2g1pHVEPW4owD/ammXNpUy
|
37
37
|
nt70FcDD4yxJQ+0YNiHd0N8IcVBM1TMIVctMNQ==
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dry-configurable
|
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
320
320
|
- !ruby/object:Gem::Version
|
321
321
|
version: '0'
|
322
322
|
requirements: []
|
323
|
-
rubygems_version: 3.
|
323
|
+
rubygems_version: 3.2.3
|
324
324
|
signing_key:
|
325
325
|
specification_version: 4
|
326
326
|
summary: Ruby based framework for working with Apache Kafka
|
metadata.gz.sig
CHANGED
Binary file
|