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 +4 -4
- data/lib/microbunny.rb +10 -4
- data/lib/microbunny/connection.rb +7 -2
- 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: 484bd50ae6eb05a870552842e9a1be6e66db1530
|
4
|
+
data.tar.gz: cc82304606c921612a8a6c6fb4db7e3db6e90e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
)
|
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
|
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
|
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-
|
11
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|