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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97115b38461bf142a06d27073199b7535a24de34
4
- data.tar.gz: e8ddf4cfb116a8625906140ccc879859d1b03257
3
+ metadata.gz: 1870e97b0d6597b618c47c6be538070633646d32
4
+ data.tar.gz: ee4d32b368950a7da676e92235f058f29a0f2f60
5
5
  SHA512:
6
- metadata.gz: eb864ca7db54908a1604d2af21585c17e3680f515badcbee953325c517f02e3c6650818396cb19fab421e1cf5f2c79eb43f4fabca0d8a87987ae0138ca52172b
7
- data.tar.gz: 98162e1514db1c74f3c20d35103ad138740d2de0c76aa52cfc3a1cc5f1d7667555b38e969fd89dd81066281fc78f124883f8a3ca387c4d0e281b6adcd8b80d0a
6
+ metadata.gz: 279994eb8e7b5e3a020b79a3ff1156abce07bf238d0a1868389943e0762361815e89079d9b97503b989468146eaa477dc4f98bbd343be23954ae06b4bb9dffe9
7
+ data.tar.gz: 4fc37c32ede490d53d7021b439429eff0497722b2b960ec6e56cc2df121cdc08cca8d58e38dfb4044ec4fce1310c15a2030aa0bf4d5e40f8256ab6e1e4a64117
@@ -43,9 +43,9 @@ module Redborder
43
43
  notify_on_create: true,
44
44
  notify_on_update: true,
45
45
  notify_on_destroy: true,
46
- key_field: nil,
47
46
  filter: nil,
48
- merge: nil
47
+ merge: nil,
48
+ key: nil
49
49
  }
50
50
  end
51
51
  end
@@ -39,7 +39,7 @@ module Redborder
39
39
 
40
40
  Redborder::KafkaNotifier.send(
41
41
  acts_as_kafka_notifier_options[:topic],
42
- message[acts_as_kafka_notifier_options[:key_field]],
42
+ message[:data][acts_as_kafka_notifier_options[:key]],
43
43
  message
44
44
  )
45
45
  end
@@ -14,5 +14,5 @@
14
14
  #######################################################################
15
15
 
16
16
  module KafkaNotifier
17
- VERSION = '0.0.1' unless defined?(::KafkaNotifier::VERSION)
18
- end
17
+ VERSION = '0.0.2' unless defined?(::KafkaNotifier::VERSION)
18
+ end
@@ -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, required_acks: 1
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafka_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Rodriguez