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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8e5f321b0b92e7e1c3f1926e28b692398fd453e22c591ad0715fa7bc93b1b34
4
- data.tar.gz: 5be7f4d4378c6a0fdc4f2edbec9fd438dca66a98ec1b9659d6a6a44d8d4d3cb4
3
+ metadata.gz: 16bc7b93d389665946fb9e09c67d4d0e9a81613a99bbe964077a3d3d356299e7
4
+ data.tar.gz: 31b3cd14099111a370f23693f63b3efcdbf247688bd133fb6e57e4ca67c670c1
5
5
  SHA512:
6
- metadata.gz: 83bde341ce60aaaee1bcfd1c323484641fcfbc7e2d8b74fcd34ef0afe7eb91dc9d332254f34049dfe5b24120bfb717bf1d7cdc758130481059fcd9b1b5a7d848
7
- data.tar.gz: 585ff0eb908008acdc9b323dd138dcb676955c2c87586f62d71d7926c534cfe988c1e071ae2b308455299a3a1672123ea054a5a70f2abea3194fad2456f38af4
6
+ metadata.gz: 9b0dae3c45fc56d43baf36ac3abcfbc22dfdf015b20e35b6455f4b8011e4bf9b125e1b7a6f00d07fa331e61ba84520f657568c6ad637578e81cff824c9c3289c
7
+ data.tar.gz: b5ba9e1a430c6c1882c61a2590c04dbc99282972ad7b81b4a05ba98f8dd6619b94f2abc1dedc3b9fd8da8d9f1202c53a4cf3a73b154ade061bc797125d8a267a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbit_carrots (1.1.0)
4
+ rabbit_carrots (1.1.1)
5
5
  bunny (>= 2.22)
6
6
  connection_pool (>= 2.4)
7
7
 
@@ -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
- exchange = channel.topic(exchange_name || RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RabbitCarrots
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_carrots
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brusk Awat