rabid_mq 0.1.7 → 0.1.8
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/rabid_mq/listener.rb +3 -7
- data/lib/rabid_mq/version.rb +1 -1
- data/lib/rabid_mq.rb +9 -2
- data/rabid_mq.gemspec +2 -1
- 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: 00c8990a2d97feae21f657180719f5d6784d4509
|
4
|
+
data.tar.gz: 34d977530cb959f6ab9996564914b4dd56327df8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b339ce90a271e03791ee69f3af6962402c2f16be3e533d014cb8d9087d8368070585f082b30c369f4b12b834396f15c4a6605f151d59418fb919cf7563ccf717
|
7
|
+
data.tar.gz: a2ec7410a4b03684072fff1be7eac0273f6816f0b2afd07cf667a32e545dd8395a8f1888f1acf16db946a97d59daa4dc630135cd4aea80197da726d5464aba2f
|
data/lib/rabid_mq/listener.rb
CHANGED
@@ -32,7 +32,7 @@ module RabidMQ
|
|
32
32
|
# end
|
33
33
|
#
|
34
34
|
def queue_name(name, **options)
|
35
|
-
@amqp_queue = RabidMQ.channel.queue(name, **options)
|
35
|
+
@amqp_queue = RabidMQ.channel.queue(name_with_env(name), **options)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Use this as a macro in including classes like
|
@@ -42,12 +42,7 @@ module RabidMQ
|
|
42
42
|
# end
|
43
43
|
#
|
44
44
|
def exchange(topic, **options)
|
45
|
-
@amqp_exchange = RabidMQ.topic_exchange
|
46
|
-
end
|
47
|
-
|
48
|
-
def env_topic(topic)
|
49
|
-
return topic unless defined?(::Rails)
|
50
|
-
topic + "[#{Rails.env}]"
|
45
|
+
@amqp_exchange = RabidMQ.topic_exchange name_with_env(topic), options
|
51
46
|
end
|
52
47
|
|
53
48
|
def bind(exchange=@amqp_exchange, routing_key: '#', **options)
|
@@ -57,6 +52,7 @@ module RabidMQ
|
|
57
52
|
delegate :subscribe, to: :bind
|
58
53
|
delegate :channel, to: ::RabidMQ
|
59
54
|
delegate :queue, to: :channel
|
55
|
+
delegate :name_with_env, to: ::RabidMQ
|
60
56
|
|
61
57
|
def amqp_connection
|
62
58
|
amqp_exchange.channel.connection
|
data/lib/rabid_mq/version.rb
CHANGED
data/lib/rabid_mq.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'bunny'
|
2
2
|
require 'yaml'
|
3
|
+
require 'sleepers'
|
3
4
|
require 'active_support/concern'
|
4
5
|
require 'active_support/core_ext/module/delegation'
|
5
6
|
require 'rabid_mq/version'
|
@@ -14,12 +15,12 @@ module RabidMQ
|
|
14
15
|
|
15
16
|
# Provide a topic exchange on demand connected to the existing channel
|
16
17
|
def topic_exchange(topic, **options)
|
17
|
-
channel.topic(topic, **options)
|
18
|
+
channel.topic(name_with_env(topic), **options)
|
18
19
|
end
|
19
20
|
|
20
21
|
# Provide fanout exchange
|
21
22
|
def fanout_exchange(topic, **options)
|
22
|
-
channel.fanout(topic, **options)
|
23
|
+
channel.fanout(name_with_env(topic), **options)
|
23
24
|
end
|
24
25
|
|
25
26
|
# Get a channel with the Bunny::Session
|
@@ -40,6 +41,12 @@ module RabidMQ
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
44
|
+
def name_with_env(name)
|
45
|
+
return name unless defined?(::Rails)
|
46
|
+
return name if name.match /\[(development|test|production)\]/
|
47
|
+
name + "[#{Rails.env}]"
|
48
|
+
end
|
49
|
+
|
43
50
|
# Provide a new or existing Bunny::Session
|
44
51
|
def connection
|
45
52
|
@connection ||= Bunny.new RabidMQ::Config.load_config
|
data/rabid_mq.gemspec
CHANGED
@@ -36,5 +36,6 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 1.14"
|
37
37
|
spec.add_development_dependency "rake", "~> 11.0"
|
38
38
|
spec.add_development_dependency "rspec", "~> 3.0"
|
39
|
-
spec.add_development_dependency "
|
39
|
+
spec.add_development_dependency "sleepers"
|
40
|
+
|
40
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabid_mq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyrone Wilson
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: sleepers
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|