codeclimate-kafka 0.7.0 → 0.8.0
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 +11 -0
- 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: 640be1086542751177d108122596f0aa7f206498
|
4
|
+
data.tar.gz: 4699108520869f781beb4a5cc997055b7bd60e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3cbdf78cf0e24306f68e1650ef68dfa685cdba8a226c1d3de6ffc3d3697de8418fde06a85d0a9fd8a1888d5ce6ee2114567a97daad5f661189ca3cddbb4db03
|
7
|
+
data.tar.gz: 581f33c8019c6c2eff05638f8df1d158cb715ce98e3cc8c4f8db76cce9e335a62b667aa945e8726c27b3145ea8e20480e220c12759486ee21f6fe7987afefe75
|
data/lib/cc/kafka/consumer.rb
CHANGED
@@ -22,6 +22,14 @@ module CC
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
|
+
def on_start(&block)
|
26
|
+
@on_start = block
|
27
|
+
end
|
28
|
+
|
29
|
+
def on_stop(&block)
|
30
|
+
@on_stop = block
|
31
|
+
end
|
32
|
+
|
25
33
|
def on_message(&block)
|
26
34
|
@on_message = block
|
27
35
|
end
|
@@ -30,6 +38,7 @@ module CC
|
|
30
38
|
trap(:TERM) { stop }
|
31
39
|
|
32
40
|
@running = true
|
41
|
+
@on_start.call(@offset) if @on_start
|
33
42
|
|
34
43
|
while @running do
|
35
44
|
fetch_messages
|
@@ -37,6 +46,8 @@ module CC
|
|
37
46
|
|
38
47
|
Kafka.logger.info("shutting down due to TERM signal")
|
39
48
|
ensure
|
49
|
+
@on_stop.call(@offset) if @on_stop
|
50
|
+
|
40
51
|
close
|
41
52
|
end
|
42
53
|
|
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.
|
4
|
+
version: 0.8.0
|
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-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson
|