mumukit-nuntius 6.0.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/nuntius/connection.rb +6 -1
- data/lib/mumukit/nuntius/consumer.rb +1 -1
- data/lib/mumukit/nuntius/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f41a3e57c0302eeca7e5b6dda661004acb4f9240c379745266e0d8cd4a8a72ec
|
4
|
+
data.tar.gz: 2ce6ee140f7a72910cd99c263c10910269ab2635cd13c3976f7503ea7d17905c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75fd69121a3cda507dc9c66379119c3f2bbf0265a1ec20718975fc9245e2f77ada859a8f0e5944d519d537a7beec2515945e4cea5771192147c19a9e933efad
|
7
|
+
data.tar.gz: e4b14193b441a6e40ca609551d155b76719eeb8a955a8952fc2f5fc3278601881926ea081d509804118a8a0ada2722bfe56f5ee23b857afda603533c475fd7db
|
@@ -7,14 +7,19 @@ class Mumukit::Nuntius::Connection
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def start_channel(exchange_name)
|
10
|
-
raise 'Nuntius connection isn\'t established' unless
|
10
|
+
raise 'Nuntius connection isn\'t established' unless connected?
|
11
11
|
channel = @connection.start.create_channel
|
12
12
|
exchange = channel.fanout(exchange_name)
|
13
13
|
[channel, exchange]
|
14
14
|
end
|
15
15
|
|
16
16
|
def establish_connection
|
17
|
+
raise 'Nuntius connection already established' if connected?
|
17
18
|
@connection = Bunny.new(host: config[:host], user: config[:user], password: config[:password])
|
18
19
|
end
|
20
|
+
|
21
|
+
def connected?
|
22
|
+
@connection.present?
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
@@ -4,7 +4,7 @@ module Mumukit::Nuntius::Consumer
|
|
4
4
|
|
5
5
|
def start(queue_name, exchange_name, &block)
|
6
6
|
Mumukit::Nuntius::Logger.info "Attaching to queue #{queue_name}"
|
7
|
-
|
7
|
+
Mumukit::Nuntius::Connection.establish_connection
|
8
8
|
channel, exchange = Mumukit::Nuntius::Connection.start_channel(exchange_name)
|
9
9
|
queue = channel.queue(queue_name, durable: true)
|
10
10
|
queue.bind(exchange)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-nuntius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02
|
11
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|