ruby-kafka 0.7.0.alpha3 → 0.7.0.alpha4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kafka/consumer.rb +16 -6
- data/lib/kafka/consumer_group.rb +4 -0
- data/lib/kafka/heartbeat.rb +7 -5
- data/lib/kafka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93553029514a22802156abc20e70cf63263f2ddc6bfe4312e11bbb629eefd017
|
4
|
+
data.tar.gz: 14c14261e50408e8ca0b0c5f14cac94939f6756bc8c5499fd2af85280218dc80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 264f0d854be944a050f7392f43c231a3499d786b5d27bf772a6a2c7b05ed7d496f8c0855e661e4e263667abe9b2d113740d92d842310052e53797588a0375034
|
7
|
+
data.tar.gz: ea31b08620b1451ac663fd16eeab8816948a3a421218282ece5c2b94417931c926ffdcbafb0436e414a3136c9ecab0442a3b477c3787d106f3380c9e18f2fcb0
|
data/lib/kafka/consumer.rb
CHANGED
@@ -235,7 +235,7 @@ module Kafka
|
|
235
235
|
mark_message_as_processed(message) if automatically_mark_as_processed
|
236
236
|
@offset_manager.commit_offsets_if_necessary
|
237
237
|
|
238
|
-
|
238
|
+
trigger_heartbeat
|
239
239
|
|
240
240
|
return if !@running
|
241
241
|
end
|
@@ -330,7 +330,7 @@ module Kafka
|
|
330
330
|
|
331
331
|
@offset_manager.commit_offsets_if_necessary
|
332
332
|
|
333
|
-
|
333
|
+
trigger_heartbeat
|
334
334
|
|
335
335
|
return if !@running
|
336
336
|
end
|
@@ -366,10 +366,18 @@ module Kafka
|
|
366
366
|
@offset_manager.mark_as_processed(message.topic, message.partition, message.offset)
|
367
367
|
end
|
368
368
|
|
369
|
-
def
|
370
|
-
@heartbeat.
|
369
|
+
def trigger_heartbeat
|
370
|
+
@heartbeat.trigger
|
371
371
|
end
|
372
372
|
|
373
|
+
def trigger_heartbeat!
|
374
|
+
@heartbeat.trigger!
|
375
|
+
end
|
376
|
+
|
377
|
+
# Aliases for the external API compatibility
|
378
|
+
alias send_heartbeat_if_necessary trigger_heartbeat
|
379
|
+
alias send_heartbeat trigger_heartbeat!
|
380
|
+
|
373
381
|
private
|
374
382
|
|
375
383
|
def consumer_loop
|
@@ -492,7 +500,7 @@ module Kafka
|
|
492
500
|
|
493
501
|
join_group unless @group.member?
|
494
502
|
|
495
|
-
|
503
|
+
trigger_heartbeat
|
496
504
|
|
497
505
|
resume_paused_partitions!
|
498
506
|
|
@@ -505,7 +513,9 @@ module Kafka
|
|
505
513
|
|
506
514
|
case tag
|
507
515
|
when :batches
|
508
|
-
|
516
|
+
# make sure any old batches, fetched prior to the completion of a consumer group sync,
|
517
|
+
# are only processed if the batches are from brokers for which this broker is still responsible.
|
518
|
+
message.select { |batch| @group.assigned_to?(batch.topic, batch.partition) }
|
509
519
|
when :exception
|
510
520
|
raise message
|
511
521
|
end
|
data/lib/kafka/consumer_group.rb
CHANGED
data/lib/kafka/heartbeat.rb
CHANGED
@@ -8,11 +8,13 @@ module Kafka
|
|
8
8
|
@last_heartbeat = Time.now
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def trigger!
|
12
|
+
@group.heartbeat
|
13
|
+
@last_heartbeat = Time.now
|
14
|
+
end
|
15
|
+
|
16
|
+
def trigger
|
17
|
+
trigger! if Time.now > @last_heartbeat + @interval
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
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.7.0.
|
4
|
+
version: 0.7.0.alpha4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digest-crc
|