microbunny 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6004da088017f240efedf6234513db4f7e3a3b8
4
- data.tar.gz: 2f97d08358e659eac313cccb0ad789ff5e19ab44
3
+ metadata.gz: 484bd50ae6eb05a870552842e9a1be6e66db1530
4
+ data.tar.gz: cc82304606c921612a8a6c6fb4db7e3db6e90e95
5
5
  SHA512:
6
- metadata.gz: 7eb1fd169b8b4020c2c32058fa2214f2d4e7f3ccf85c48fdc3ccc092b68e366965c117050cae1e4d589578da71724f4a526846563743d488938379bacbca8f52
7
- data.tar.gz: 188db2b1c7338f611915dcaacb62edad977a32a6ffe87ec49bb6eb507b9164564b1802afa7bd7564cb6879534b36649cfa75d23ea9e7ef91d94327247e219114
6
+ metadata.gz: 5d07b7b4fc067f03467b73de25022589e9b4b4827822f71b6e6460bee6245d22e5724529ce41d30bc0e0047e3c43c05c41afc66b0af46ba99233f9241a49dcfc
7
+ data.tar.gz: d3e4ca8098f3a32f1a025011abce3c0bcc7fa0a30b1762dcf0eb4f374559d0eb9514100a480e569260e2f15cec2e8bafc9c339f58fbd72237eef6593e617e697
data/lib/microbunny.rb CHANGED
@@ -12,7 +12,7 @@ require_relative 'microbunny/payload'
12
12
 
13
13
  module MicroBunny
14
14
  class << self
15
- attr_accessor :settings, :channel
15
+ attr_accessor :settings, :connection, :channel
16
16
 
17
17
  def configure
18
18
  self.settings ||= Settings.new
@@ -20,14 +20,20 @@ module MicroBunny
20
20
  end
21
21
 
22
22
  def start
23
- self.channel = Connection.new(
23
+ self.connection = Connection.new(
24
24
  host: self.settings.host,
25
25
  vhost: self.settings.vhost,
26
26
  username: self.settings.username,
27
27
  password: self.settings.password
28
- ).channel
28
+ )
29
+
30
+ self.channel = self.connection.channel
29
31
  end
30
-
32
+
33
+ def stop
34
+ self.connection.stop
35
+ end
36
+
31
37
  def subscribe(topics, record_ids = [])
32
38
  raise_bad_start unless self.channel
33
39
 
@@ -2,10 +2,11 @@ module MicroBunny
2
2
  class Connection
3
3
  def initialize(host:, vhost: nil, username: 'guest', password: 'guest')
4
4
  @conn = Bunny.new(
5
- host: host,
5
+ host,
6
6
  vhost: vhost,
7
7
  username: username,
8
- password: password
8
+ password: password,
9
+ continuation_timeout: 10000
9
10
  )
10
11
  conn.start
11
12
  end
@@ -14,6 +15,10 @@ module MicroBunny
14
15
  @channel ||= conn.create_channel
15
16
  end
16
17
 
18
+ def stop
19
+ conn.close
20
+ end
21
+
17
22
  private
18
23
  attr_reader :conn
19
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microbunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Lebrun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-08 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny