mafia_amqp 0.1.0 → 0.1.1
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/mafia.rb +9 -0
- data/lib/mafia/consumer_pool.rb +4 -0
- data/lib/mafia/dealer.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc89fd3d263db62a1e8ebf6aa79d834e7e14dab
|
4
|
+
data.tar.gz: 7399e2e1939551250a57afd79f329f49da8991f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f7044f760e1e4cc606d00d7a925c9fef59338a75622e29ffd8c0ef74a434efa415c88942c51446e8255001626782b13b6ec699f7e44d1fe8cee4512dcbe0b1
|
7
|
+
data.tar.gz: 6113116ed5b2cfc5623400002d6bf498dc2ac334bc4e53385d30b17ffd814cb591035b0501eede77a6f88379fc8b753e67293f66dc7ae22efc963d922942e1ea
|
data/lib/mafia.rb
CHANGED
@@ -34,4 +34,13 @@ module Mafia
|
|
34
34
|
def self.log_level
|
35
35
|
@config[:log_level] || ::Logger::INFO
|
36
36
|
end
|
37
|
+
|
38
|
+
def self.config_to_url(config)
|
39
|
+
user = config[:username]
|
40
|
+
password = config[:password]
|
41
|
+
host = config[:host]
|
42
|
+
port = config[:port]
|
43
|
+
vhost = config[:vhost]
|
44
|
+
"amqp://#{user}:#{password}@#{host}:#{port}#{vhost}"
|
45
|
+
end
|
37
46
|
end
|
data/lib/mafia/consumer_pool.rb
CHANGED
@@ -3,9 +3,13 @@ module Mafia
|
|
3
3
|
def initialize(config=nil)
|
4
4
|
@config = config || Mafia.config
|
5
5
|
|
6
|
+
Mafia.logger.info("Mafia consumer pool starting connection to #{Mafia.config_to_url(@config)}")
|
7
|
+
|
6
8
|
@conn = Bunny.new(@config.slice(:host, :port, :username, :password, :vhost))
|
7
9
|
@conn.start
|
8
10
|
|
11
|
+
Mafia.logger.info("Mafia consumer pool started, waiting for rpc events")
|
12
|
+
|
9
13
|
# create a channel and exchange that both client and server know about
|
10
14
|
@channel = @conn.create_channel
|
11
15
|
@queue = @channel.queue(@config[:queue])
|
data/lib/mafia/dealer.rb
CHANGED
@@ -3,9 +3,12 @@ module Mafia
|
|
3
3
|
def initialize(config=nil)
|
4
4
|
@config = config || Mafia.config
|
5
5
|
|
6
|
+
Mafia.logger.info("Mafia dealer starting connection to #{Mafia.config_to_url(@config)}")
|
6
7
|
@conn = Bunny.new(@config.slice(:host, :port, :username, :password, :vhost))
|
7
8
|
@conn.start
|
8
9
|
|
10
|
+
Mafia.logger.info("Mafia dealer connection started")
|
11
|
+
|
9
12
|
# create a channel and exchange that both client and server know about
|
10
13
|
@channel = @conn.create_channel
|
11
14
|
@queue = @channel.queue(@config[:queue])
|