codeclimate-kafka 0.1.0 → 0.1.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/producer.rb +8 -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: b4d8e754a10740c9e3c00721921c3a30bf3614fb
|
4
|
+
data.tar.gz: 92d2c55a3369689870d9b5019ffd2e5e83411bdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d0680001aec2fdec1c1e40aa7a8e1798b046f5ff2deda2d76cd83e9c8e794ea5f3253623b3c5d650dfe20966a6aae9c941bca6156493b83337a96362f890138
|
7
|
+
data.tar.gz: 3257fe99d81ee0333b5c65ebb24424a568a1166be3f8f1386084fcb00dbbc9a8df678deb2f301d371f85a366e4c8b402123338ab4d09b5fb98df7bcb917b89d2
|
data/lib/cc/kafka/producer.rb
CHANGED
@@ -15,14 +15,20 @@ module CC
|
|
15
15
|
def initialize(url, client_id = nil)
|
16
16
|
@url = url
|
17
17
|
@client_id = client_id
|
18
|
+
|
19
|
+
Kafka.logger.debug("initialized client for #{@url} (id: #{@client_id.inspect})")
|
18
20
|
end
|
19
21
|
|
20
22
|
def send_message(data, key = nil)
|
23
|
+
Kafka.logger.debug("data: #{data.inspect}, key: #{key.inspect}")
|
24
|
+
|
21
25
|
serialized = BSON.serialize(data).to_s
|
22
26
|
|
23
27
|
if http?
|
28
|
+
Kafka.logger.debug("sending message over HTTP")
|
24
29
|
send_http(serialized, key)
|
25
30
|
else
|
31
|
+
Kafka.logger.debug("sending message direct via Poseidon")
|
26
32
|
send_poseidon(serialized, key)
|
27
33
|
end
|
28
34
|
end
|
@@ -52,6 +58,8 @@ module CC
|
|
52
58
|
request = Net::HTTP::Post.new("/message")
|
53
59
|
request.set_form_data(data)
|
54
60
|
|
61
|
+
Kafka.logger.debug("POST #{uri.host}:#{uri.port}/message")
|
62
|
+
Kafka.logger.debug("form data: #{data.inspect}")
|
55
63
|
response = http.request(request)
|
56
64
|
|
57
65
|
unless response.is_a?(Net::HTTPSuccess)
|
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.1.
|
4
|
+
version: 0.1.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-07-
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson
|