ruby-kafka 0.3.13.beta4 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -4
- data/README.md +2 -0
- data/lib/kafka/consumer.rb +20 -2
- data/lib/kafka/fetched_batch.rb +8 -0
- data/lib/kafka/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9464a030fbaaa71d6b6095fe7519787396afbc2d
|
4
|
+
data.tar.gz: f432a7bf7401371251522b75980ff9116c8cb89e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbedf9f17a00f597700775919f396803f80a77cca6b33ef7c0217569a2c5d05c2f4aa6e834bb005c37b1eb090b3fb4ac994e5b3aef166bd7dc6df471c866d79b
|
7
|
+
data.tar.gz: c9d7e0b9a37e2c081e3bbba5ba644997311b167900df4054df4e6204c456d1652fb022019662c4b3d58a86f1f56c660a0e52efefe52e5c5247ee905e3b8e97d9
|
data/CHANGELOG.md
CHANGED
@@ -4,12 +4,9 @@ Changes and additions to the library will be listed here.
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
|
7
|
-
## v0.3.
|
7
|
+
## v0.3.14
|
8
8
|
|
9
9
|
- Automatically recover from invalid consumer checkpoints.
|
10
|
-
|
11
|
-
## v0.3.13.beta1
|
12
|
-
|
13
10
|
- Minimize the number of times messages are reprocessed after a consumer group resync.
|
14
11
|
- Improve instrumentation of the async producer.
|
15
12
|
|
data/README.md
CHANGED
@@ -228,6 +228,8 @@ data = JSON.dump(event)
|
|
228
228
|
producer.produce(data, topic: "events")
|
229
229
|
```
|
230
230
|
|
231
|
+
There's also an example of [encoding messages with Apache Avro](https://github.com/zendesk/ruby-kafka/wiki/Encoding-messages-with-Avro).
|
232
|
+
|
231
233
|
#### Partitioning
|
232
234
|
|
233
235
|
Kafka topics are partitioned, with messages being assigned to a partition by the client. This allows a great deal of flexibility for the users. This section describes several strategies for partitioning and how they impact performance, data locality, etc.
|
data/lib/kafka/consumer.rb
CHANGED
@@ -125,7 +125,15 @@ module Kafka
|
|
125
125
|
value: message.value,
|
126
126
|
)
|
127
127
|
|
128
|
-
|
128
|
+
begin
|
129
|
+
yield message
|
130
|
+
rescue => e
|
131
|
+
location = "#{message.topic}/#{message.partition} at offset #{message.offset}"
|
132
|
+
backtrace = e.backtrace.join("\n")
|
133
|
+
@logger.error "Exception raised when processing #{location} -- #{e.class}: #{e}\n#{backtrace}"
|
134
|
+
|
135
|
+
raise
|
136
|
+
end
|
129
137
|
end
|
130
138
|
|
131
139
|
mark_message_as_processed(message)
|
@@ -176,7 +184,17 @@ module Kafka
|
|
176
184
|
message_count: batch.messages.count,
|
177
185
|
)
|
178
186
|
|
179
|
-
|
187
|
+
begin
|
188
|
+
yield batch
|
189
|
+
rescue => e
|
190
|
+
offset_range = batch.empty? ? "N/A" : [batch.first_offset, batch.last_offset].join("..")
|
191
|
+
location = "#{batch.topic}/#{batch.partition} in offset range #{offset_range}"
|
192
|
+
backtrace = e.backtrace.join("\n")
|
193
|
+
|
194
|
+
@logger.error "Exception raised when processing #{location} -- #{e.class}: #{e}\n#{backtrace}"
|
195
|
+
|
196
|
+
raise
|
197
|
+
end
|
180
198
|
end
|
181
199
|
|
182
200
|
mark_message_as_processed(batch.messages.last)
|
data/lib/kafka/fetched_batch.rb
CHANGED
data/lib/kafka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-kafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -303,9 +303,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
303
303
|
version: 2.1.0
|
304
304
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
305
305
|
requirements:
|
306
|
-
- - "
|
306
|
+
- - ">="
|
307
307
|
- !ruby/object:Gem::Version
|
308
|
-
version:
|
308
|
+
version: '0'
|
309
309
|
requirements: []
|
310
310
|
rubyforge_project:
|
311
311
|
rubygems_version: 2.4.5.1
|