anschel 0.6.4 → 0.6.5

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: d4788b6213db1bd12665c8013ac0febdf050c4fa
4
- data.tar.gz: a5aeac6a4793ac4f8dfb462c806bb0ea5c071ad1
3
+ metadata.gz: bbe6eb2c7595931308ffa51a7c5c246d70bc0bd2
4
+ data.tar.gz: c982d14ef5c18395f19dea1803875ee81dce3377
5
5
  SHA512:
6
- metadata.gz: 7590527e3cab6ebd0376600052a0ad4af8c2316f422da61f088d38fd6420fd2f2713ec9f44e8ca905a44ab2f10f4f2459b5bd14dd2c440ae568d6904be35eb60
7
- data.tar.gz: d3f92b3da36d68f3114bac609f1446f5eaddc07982f89a89f7ba2d699ec69ff6fd4a9b2412f6ea924bcf601676cfbbbdeebeb8a402a2aec6b9a142488317f0ad
6
+ metadata.gz: a7664952bdf55874f8f883dead99b346034d565462d11e37246ce9437f0d730721eb1726333e492731f159bae02779c5cdbbeaeea80655135fe51ef7a49b6841
7
+ data.tar.gz: 9dccba8d5cd9cef7ce7e841c95a224807a297091503a9eef98787e75f9d22fbd751149638bca0e0af93ac6d4b4d2f77bb23ec37a0186bfc389e10e9f5bd2f083
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.4
1
+ 0.6.5
@@ -6,9 +6,9 @@ require_relative 'base'
6
6
  module Anschel
7
7
  class Input
8
8
  class Kafka < Base
9
- def initialize queue, config, stats, log
9
+ def initialize output, config, stats, log
10
10
  @consumer_group = ::Kafka::Group.new config
11
- @consumer_group.run num_cpus, queue
11
+ @consumer_group.run num_cpus, output
12
12
  end
13
13
 
14
14
  def stop
@@ -6,31 +6,43 @@ require_relative 'base'
6
6
  module Anschel
7
7
  class Input
8
8
  class RabbitMQ < Base
9
- def initialize queue, config, stats, log
10
- default_exchange = {
9
+ def initialize output, config, stats, log
10
+ exchange_defaults = {
11
11
  type: 'x-consistent-hash',
12
12
  durable: true
13
13
  }
14
14
 
15
- default_qconf = {
15
+ queue_defaults = {
16
16
  exclusive: false,
17
17
  auto_delete: false,
18
18
  durable: true
19
19
  }
20
20
 
21
+ subscription_defaults = {
22
+ block: true,
23
+ ack: true
24
+ }
25
+
21
26
  exchange_name = config[:exchange].delete(:name)
22
27
 
23
- @threads = config[:queues].map do |qname, qconf|
28
+ @threads = config[:queues].map do |queue_name, queue_config|
24
29
  Thread.new do
25
- conn = ::MarchHare.connect config[:connection]
26
- chan = conn.create_channel
30
+ connection = ::MarchHare.connect config[:connection]
31
+
32
+ channel = connection.create_channel
33
+
34
+ exchange = channel.exchange exchange_name, \
35
+ exchange_defaults.merge(config[:exchange])
36
+
37
+ queue = channel.queue queue_name.to_s, \
38
+ queue_defaults.merge(queue_config)
27
39
 
28
- exchange = chan.exchange exchange_name, \
29
- default_exchange.merge(config[:exchange])
40
+ subscription = subscription_defaults.merge \
41
+ (config[:subscription] || {})
30
42
 
31
- rmq = chan.queue qname.to_s, default_qconf.merge(qconf)
32
- rmq.subscribe(block: true) do |_, message|
33
- queue << message
43
+ queue.subscribe(subscription) do |meta, message|
44
+ output << message
45
+ channel.ack meta.delivery_tag, false if subscription[:ack]
34
46
  end
35
47
  end
36
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anschel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -165,3 +165,4 @@ signing_key:
165
165
  specification_version: 4
166
166
  summary: Logstash-like for moving events from Kafka into Elasticsearch
167
167
  test_files: []
168
+ has_rdoc: