sbmt-kafka_consumer 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/sbmt/kafka_consumer/base_consumer.rb +22 -10
- data/lib/sbmt/kafka_consumer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db2a1a6eecab6ef429ef1591991a38e19d5996f1881f8e21e1382513ccd972b
|
4
|
+
data.tar.gz: 490e1c37ce5029efe299119cd7a879fbdb7e0ee3be8e1bc49f4c18a7ad0a0b4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11ab3951c1caa9cf2975199c4815838058c719038f77cdc8d563ef36248eebf312cf06e66d9b43058918f3042f88312144f36183f0cddfe882c3b9c03b5e5c8d
|
7
|
+
data.tar.gz: 5eedd592dd638ac22181e2bd5717e8ef63ca2e4b23cfa1c79c05c0fb3c1596586492eff32c3a5b1475ce997dd8f184e0e6e9024252922409fc3dee5d474e7d8b
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
13
13
|
|
14
14
|
### Fixed
|
15
15
|
|
16
|
+
## [2.7.0] - 2024-07-30
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- When using strategy `cooperative-sticky`, method `mark_as_consumed` is used ([more details](https://github.com/karafka/karafka/wiki/FAQ#why-when-using-cooperative-sticky-rebalance-strategy-all-topics-get-revoked-on-rebalance))
|
21
|
+
|
22
|
+
## [2.6.1] - 2024-07-05
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- Use the current `trace_id` instead of creating a new one
|
27
|
+
|
16
28
|
## [2.6.0] - 2024-07-01
|
17
29
|
|
18
30
|
### Added
|
@@ -3,8 +3,6 @@
|
|
3
3
|
module Sbmt
|
4
4
|
module KafkaConsumer
|
5
5
|
class BaseConsumer < Karafka::BaseConsumer
|
6
|
-
attr_reader :trace_id
|
7
|
-
|
8
6
|
def self.consumer_klass(skip_on_error: false, middlewares: [])
|
9
7
|
Class.new(self) do
|
10
8
|
const_set(:SKIP_ON_ERROR, skip_on_error)
|
@@ -21,7 +19,7 @@ module Sbmt
|
|
21
19
|
if process_batch?
|
22
20
|
with_batch_instrumentation(messages) do
|
23
21
|
process_batch(messages)
|
24
|
-
|
22
|
+
mark_message(messages.last)
|
25
23
|
end
|
26
24
|
else
|
27
25
|
messages.each do |message|
|
@@ -41,8 +39,6 @@ module Sbmt
|
|
41
39
|
private
|
42
40
|
|
43
41
|
def with_instrumentation(message)
|
44
|
-
@trace_id = SecureRandom.base58
|
45
|
-
|
46
42
|
logger.tagged(
|
47
43
|
trace_id: trace_id,
|
48
44
|
topic: message.metadata.topic, partition: message.metadata.partition,
|
@@ -69,8 +65,6 @@ module Sbmt
|
|
69
65
|
end
|
70
66
|
|
71
67
|
def with_batch_instrumentation(messages)
|
72
|
-
@trace_id = SecureRandom.base58
|
73
|
-
|
74
68
|
logger.tagged(
|
75
69
|
trace_id: trace_id,
|
76
70
|
first_offset: messages.first.metadata.offset,
|
@@ -88,8 +82,6 @@ module Sbmt
|
|
88
82
|
end
|
89
83
|
|
90
84
|
def with_common_instrumentation(name, message)
|
91
|
-
@trace_id = SecureRandom.base58
|
92
|
-
|
93
85
|
logger.tagged(
|
94
86
|
trace_id: trace_id
|
95
87
|
) do
|
@@ -116,7 +108,7 @@ module Sbmt
|
|
116
108
|
end
|
117
109
|
|
118
110
|
with_common_instrumentation("mark_as_consumed", message) do
|
119
|
-
|
111
|
+
mark_message(message)
|
120
112
|
end
|
121
113
|
end
|
122
114
|
|
@@ -173,6 +165,26 @@ module Sbmt
|
|
173
165
|
end
|
174
166
|
traverse_chain.call
|
175
167
|
end
|
168
|
+
|
169
|
+
def trace_id
|
170
|
+
@trace_id ||= SecureRandom.base58
|
171
|
+
end
|
172
|
+
|
173
|
+
def config
|
174
|
+
@config ||= Sbmt::KafkaConsumer::Config.new
|
175
|
+
end
|
176
|
+
|
177
|
+
def cooperative_sticky?
|
178
|
+
config.partition_assignment_strategy == "cooperative-sticky"
|
179
|
+
end
|
180
|
+
|
181
|
+
def mark_message(message)
|
182
|
+
if cooperative_sticky?
|
183
|
+
mark_as_consumed(message)
|
184
|
+
else
|
185
|
+
mark_as_consumed!(message)
|
186
|
+
end
|
187
|
+
end
|
176
188
|
end
|
177
189
|
end
|
178
190
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sbmt-kafka_consumer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sbermarket Ruby-Platform Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -570,7 +570,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
570
570
|
- !ruby/object:Gem::Version
|
571
571
|
version: '0'
|
572
572
|
requirements: []
|
573
|
-
rubygems_version: 3.
|
573
|
+
rubygems_version: 3.1.6
|
574
574
|
signing_key:
|
575
575
|
specification_version: 4
|
576
576
|
summary: Ruby gem for consuming Kafka messages
|