kafka_notifier 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kafka_notifier/base.rb +2 -2
- data/lib/kafka_notifier/model.rb +1 -1
- data/lib/kafka_notifier/version.rb +2 -2
- data/lib/kafka_notifier.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1870e97b0d6597b618c47c6be538070633646d32
|
4
|
+
data.tar.gz: ee4d32b368950a7da676e92235f058f29a0f2f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 279994eb8e7b5e3a020b79a3ff1156abce07bf238d0a1868389943e0762361815e89079d9b97503b989468146eaa477dc4f98bbd343be23954ae06b4bb9dffe9
|
7
|
+
data.tar.gz: 4fc37c32ede490d53d7021b439429eff0497722b2b960ec6e56cc2df121cdc08cca8d58e38dfb4044ec4fce1310c15a2030aa0bf4d5e40f8256ab6e1e4a64117
|
data/lib/kafka_notifier/base.rb
CHANGED
data/lib/kafka_notifier/model.rb
CHANGED
data/lib/kafka_notifier.rb
CHANGED
@@ -23,14 +23,20 @@ require 'kafka_notifier/message_queue'
|
|
23
23
|
module Redborder
|
24
24
|
module KafkaNotifier
|
25
25
|
mattr_accessor :config
|
26
|
+
mattr_accessor :partitioner
|
26
27
|
mattr_accessor :producer
|
27
28
|
mattr_accessor :message_queue
|
28
29
|
|
30
|
+
self.partitioner = proc do |key, partition_count|
|
31
|
+
Zlib.crc32(key) % partition_count
|
32
|
+
end
|
33
|
+
|
29
34
|
self.config = YAML.load(File.read('config/kafka.yml')).symbolize_keys
|
30
35
|
|
31
36
|
def self.start
|
32
37
|
self.producer = Poseidon::Producer.new(
|
33
|
-
config[:brokers], config[:client_id], type: :sync,
|
38
|
+
config[:brokers], config[:client_id], type: :sync,
|
39
|
+
required_acks: 1, partitioner: partitioner
|
34
40
|
)
|
35
41
|
|
36
42
|
self.message_queue = MessageQueue.new(500, 1)
|