rabbit_carrots 1.1.0 → 1.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/Gemfile.lock +1 -1
- data/lib/rabbit_carrots/core.rb +9 -1
- data/lib/rabbit_carrots/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16bc7b93d389665946fb9e09c67d4d0e9a81613a99bbe964077a3d3d356299e7
|
|
4
|
+
data.tar.gz: 31b3cd14099111a370f23693f63b3efcdbf247688bd133fb6e57e4ca67c670c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b0dae3c45fc56d43baf36ac3abcfbc22dfdf015b20e35b6455f4b8011e4bf9b125e1b7a6f00d07fa331e61ba84520f657568c6ad637578e81cff824c9c3289c
|
|
7
|
+
data.tar.gz: b5ba9e1a430c6c1882c61a2590c04dbc99282972ad7b81b4a05ba98f8dd6619b94f2abc1dedc3b9fd8da8d9f1202c53a4cf3a73b154ade061bc797125d8a267a
|
data/Gemfile.lock
CHANGED
data/lib/rabbit_carrots/core.rb
CHANGED
|
@@ -79,7 +79,15 @@ module RabbitCarrots
|
|
|
79
79
|
|
|
80
80
|
def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}, exchange_name: nil, kill_to_restart_on_standard_error: false)
|
|
81
81
|
RabbitCarrots::Connection.instance.channel.with do |channel|
|
|
82
|
-
|
|
82
|
+
exchange_name ||= RabbitCarrots.configuration.rabbitmq_exchange_name
|
|
83
|
+
|
|
84
|
+
begin
|
|
85
|
+
# Try to passively read an existing exchange without declaring it
|
|
86
|
+
exchange = channel.topic(exchange_name, passive: true)
|
|
87
|
+
rescue Bunny::NotFound
|
|
88
|
+
# If the exchange does not exist, declare it
|
|
89
|
+
exchange = channel.topic(exchange_name, durable: true)
|
|
90
|
+
end
|
|
83
91
|
|
|
84
92
|
logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}"
|
|
85
93
|
queue = channel.queue(queue_name, durable: true, arguments: queue_arguments)
|