karafka 1.4.2 → 1.4.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.github/workflows/ci.yml +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +6 -7
- 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/server.rb +1 -1
- data/lib/karafka/version.rb +1 -1
- metadata +2 -2
- 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.tar.gz.sig
CHANGED
|
Binary file
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
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)
|
|
@@ -81,11 +81,11 @@ GEM
|
|
|
81
81
|
activesupport (>= 5.0.0)
|
|
82
82
|
i18n (1.8.9)
|
|
83
83
|
concurrent-ruby (~> 1.0)
|
|
84
|
-
io-console (0.5.
|
|
84
|
+
io-console (0.5.9)
|
|
85
85
|
irb (1.3.4)
|
|
86
86
|
reline (>= 0.1.5)
|
|
87
87
|
king_konf (1.0.0)
|
|
88
|
-
minitest (5.14.
|
|
88
|
+
minitest (5.14.4)
|
|
89
89
|
rake (13.0.3)
|
|
90
90
|
reline (0.2.4)
|
|
91
91
|
io-console (~> 0.5)
|
|
@@ -113,7 +113,7 @@ GEM
|
|
|
113
113
|
thor (1.1.0)
|
|
114
114
|
tzinfo (2.0.4)
|
|
115
115
|
concurrent-ruby (~> 1.0)
|
|
116
|
-
waterdrop (1.4.
|
|
116
|
+
waterdrop (1.4.1)
|
|
117
117
|
delivery_boy (>= 0.2, < 2.x)
|
|
118
118
|
dry-configurable (~> 0.8)
|
|
119
119
|
dry-monitor (~> 0.3)
|
|
@@ -123,8 +123,7 @@ GEM
|
|
|
123
123
|
zeitwerk (2.4.2)
|
|
124
124
|
|
|
125
125
|
PLATFORMS
|
|
126
|
-
|
|
127
|
-
x86_64-darwin-19
|
|
126
|
+
x86_64-linux
|
|
128
127
|
|
|
129
128
|
DEPENDENCIES
|
|
130
129
|
byebug
|
|
@@ -134,4 +133,4 @@ DEPENDENCIES
|
|
|
134
133
|
simplecov
|
|
135
134
|
|
|
136
135
|
BUNDLED WITH
|
|
137
|
-
2.2.
|
|
136
|
+
2.2.15
|
data/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
[](https://github.com/karafka/karafka/actions/workflows/ci.yml)
|
|
4
|
+
[](http://badge.fury.io/rb/karafka)
|
|
5
|
+
[](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
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: 2021-
|
|
39
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
|
40
40
|
dependencies:
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: dry-configurable
|
metadata.gz.sig
CHANGED
|
Binary file
|