rabid_mq 0.1.43 → 0.1.44

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb60a3e50bcd10e4e0e806cb12e718d77200cc75
4
- data.tar.gz: 9c98df8538d801409b6665f092015fd612e22554
3
+ metadata.gz: 876f18a0ca863c79e2279dbdb452b0e27ebbecf8
4
+ data.tar.gz: 2720f66312906348017b661ea72df32f23bcfdac
5
5
  SHA512:
6
- metadata.gz: 6e22f2d060d90cd57c10c867a186a2ce28cff7272e4766b92da18b3bc93ce7bbf868508b5fffd193b9dc077334d78a98e51ef6fc7088f915807140c50229f485
7
- data.tar.gz: d66e63430d783dc1f8684a09ffc52e0d171bff5121a882132fc2d66d255faa213228320f01d580059ff401b7d040ca6a1af734051ae60c863cf2311bbe2edf74
6
+ metadata.gz: f9a3a65c9adc1137f46b484deed119ea52330b497b55693c775d35b2a0425e3933171e79859965efb138793ee11da02363a074edfaef7c592f2df5d7809b692e
7
+ data.tar.gz: e4872b8978651ece5c30f5427f24aeffe03c27b905d6a3831ffa832094d97b6ce6897ac41901ec66583532b1c93b389ab3af9a5bb67e1f6f91ec3b72331b2985
@@ -46,6 +46,8 @@ module RabidMQ
46
46
  def topic_exchange(topic, include_environment_name: true, **options)
47
47
  topic_name = include_environment_name ? name_with_env(topic) : topic
48
48
  channel.topic(topic_name, **options)
49
+ rescue Bunny::PreconditionFailed => e
50
+ topic_exchange(topic, include_environment_name: include_environment_name, durable: !options.fetch(:durable), **options)
49
51
  end
50
52
 
51
53
  # Provide fanout exchange
@@ -1,3 +1,3 @@
1
1
  module RabidMQ
2
- VERSION = "0.1.43"
2
+ VERSION = "0.1.44"
3
3
  end
data/lib/rabid_mq.rb CHANGED
@@ -15,13 +15,17 @@ module RabidMQ
15
15
  class << self
16
16
 
17
17
  # Provide a topic exchange on demand connected to the existing channel
18
- def topic_exchange(topic, **options)
19
- channel.topic(name_with_env(topic), **options)
18
+ def topic_exchange(topic, include_environment_name: true, **options)
19
+ topic_name = include_environment_name ? name_with_env(topic) : topic
20
+ channel.topic(topic_name, **options)
21
+ rescue Bunny::PreconditionFailed => e
22
+ topic_exchange(topic, include_environment_name: include_environment_name, durable: !options.fetch(:durable), **options)
20
23
  end
21
24
 
22
25
  # Provide fanout exchange
23
- def fanout_exchange(topic, **options)
24
- channel.fanout(name_with_env(topic), **options)
26
+ def fanout_exchange(topic, include_environment_name: true, **options)
27
+ topic_name = include_environment_name ? name_with_env(topic) : topic
28
+ channel.fanout(topic_name, **options)
25
29
  end
26
30
 
27
31
  # Get a channel with the Bunny::Session
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabid_mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.43
4
+ version: 0.1.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyrone Wilson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-15 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny