codeclimate-kafka 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cc/kafka/consumer.rb +18 -7
- data/lib/cc/kafka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92066282ad52952c0f184b8be734a682252cba67
|
4
|
+
data.tar.gz: 176ec99b426a28babea557303bd7db2660762b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1971e008cb9aa3516db9c694a86d3e3dc9746eaeecd1633baf521f2954561756880001a590ea407d0fffc9c0dd91a04a6273a3e71038e1bc67a5eedc8f1c1da9
|
7
|
+
data.tar.gz: a593ecb557bc52ddc7cd4319f58a0c9875906c606037e5ff969ecb7eed395170fc2bc87c118552a6482bfaa54690ad3d7b667e912f0cc4b68e0d5df73df8201d
|
data/lib/cc/kafka/consumer.rb
CHANGED
@@ -37,13 +37,28 @@ module CC
|
|
37
37
|
|
38
38
|
Kafka.logger.info("shutting down due to TERM signal")
|
39
39
|
ensure
|
40
|
-
|
40
|
+
close
|
41
41
|
end
|
42
42
|
|
43
43
|
def stop
|
44
44
|
@running = false
|
45
45
|
end
|
46
46
|
|
47
|
+
def fetch
|
48
|
+
@consumer.fetch
|
49
|
+
rescue Poseidon::Errors::UnknownTopicOrPartition
|
50
|
+
Kafka.logger.debug("topic #{@offset.topic.inspect} not created yet")
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_offset(current_offset)
|
55
|
+
@offset.set(current: current_offset)
|
56
|
+
end
|
57
|
+
|
58
|
+
def close
|
59
|
+
@consumer.close
|
60
|
+
end
|
61
|
+
|
47
62
|
private
|
48
63
|
|
49
64
|
def current_offset(offset)
|
@@ -51,10 +66,10 @@ module CC
|
|
51
66
|
end
|
52
67
|
|
53
68
|
def fetch_messages
|
54
|
-
|
69
|
+
fetch.each do |message|
|
55
70
|
Kafka.statsd.increment("messages.received")
|
56
71
|
Kafka.statsd.time("messages.processing") do
|
57
|
-
|
72
|
+
set_offset(message.offset + 1)
|
58
73
|
|
59
74
|
Kafka.offset_model.transaction do
|
60
75
|
data = BSON.deserialize(message.value)
|
@@ -69,10 +84,6 @@ module CC
|
|
69
84
|
end
|
70
85
|
Kafka.statsd.increment("messages.processed")
|
71
86
|
end
|
72
|
-
rescue Poseidon::Errors::UnknownTopicOrPartition
|
73
|
-
Kafka.logger.debug("topic #{@topic} not created yet")
|
74
|
-
|
75
|
-
sleep 1
|
76
87
|
end
|
77
88
|
end
|
78
89
|
end
|
data/lib/cc/kafka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-kafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Climate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson
|