From 8a95f695566fd4fe4153f14bcedc5ad6786d5004 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Wed, 6 Dec 2023 14:11:14 +0300 Subject: [PATCH 1/4] Updates dependencies versions --- Gemfile | 8 ++--- Gemfile.lock | 74 +++++++++++++++++++++++++----------------- rabbit_carrots.gemspec | 4 +-- 3 files changed, 51 insertions(+), 35 deletions(-) diff --git a/Gemfile b/Gemfile index bec74e4..1c72b0d 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,10 @@ source 'https://rubygems.org' # Specify your gem's dependencies in rabbit_carrots.gemspec gemspec -gem 'rake', '~> 13.0' +gem 'rake', '~> 13.1' -gem 'rspec', '~> 3.0' +gem 'rspec', '~> 3.12' -gem 'rubocop', '~> 1.21' +gem 'rubocop', '~> 1.58' -gem 'rubocop-rails', '~> 2.17' +gem 'rubocop-rails', '~> 2.22' diff --git a/Gemfile.lock b/Gemfile.lock index 4a90046..5cfd915 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,52 @@ PATH remote: . specs: - rabbit_carrots (0.1.19) - bunny (>= 2.19.0) - connection_pool (~> 2.3.0) + rabbit_carrots (0.1.20) + bunny (>= 2.22) + connection_pool (~> 2.4) GEM remote: https://rubygems.org/ specs: - activesupport (7.0.4) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) amq-protocol (2.3.2) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.4) bunny (2.22.0) amq-protocol (~> 2.3, >= 2.3.1) sorted_set (~> 1, >= 1.0.2) - concurrent-ruby (1.1.10) - connection_pool (2.3.0) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) diff-lcs (1.5.0) - i18n (1.12.0) + drb (2.2.0) + ruby2_keywords + i18n (1.14.1) concurrent-ruby (~> 1.0) - json (2.6.2) - minitest (5.16.3) - parallel (1.22.1) - parser (3.1.2.1) + json (2.7.1) + language_server-protocol (3.17.0.3) + minitest (5.20.0) + mutex_m (0.2.0) + parallel (1.23.0) + parser (3.2.2.4) ast (~> 2.4.1) - rack (3.0.4.2) + racc + racc (1.7.3) + rack (3.0.8) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rbtree (0.4.6) - regexp_parser (2.6.1) - rexml (3.2.5) + regexp_parser (2.8.3) + rexml (3.2.6) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -47,40 +60,43 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.0) - rubocop (1.39.0) + rubocop (1.58.0) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - rubocop-rails (2.17.3) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-rails (2.22.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - ruby-progressbar (1.11.0) + rubocop-ast (>= 1.30.0, < 2.0) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) set (1.0.3) sorted_set (1.0.3) rbtree set (~> 1.0) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.3.0) + unicode-display_width (2.5.0) PLATFORMS x86_64-linux DEPENDENCIES rabbit_carrots! - rake (~> 13.0) - rspec (~> 3.0) - rubocop (~> 1.21) - rubocop-rails (~> 2.17) + rake (~> 13.1) + rspec (~> 3.12) + rubocop (~> 1.58) + rubocop-rails (~> 2.22) BUNDLED WITH 2.3.26 diff --git a/rabbit_carrots.gemspec b/rabbit_carrots.gemspec index 0a4aedc..706e5ce 100644 --- a/rabbit_carrots.gemspec +++ b/rabbit_carrots.gemspec @@ -32,8 +32,8 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] # Uncomment to register a new dependency of your gem - spec.add_dependency 'bunny', '>= 2.19.0' - spec.add_dependency 'connection_pool', '~> 2.3.0' + spec.add_dependency 'bunny', '>= 2.22' + spec.add_dependency 'connection_pool', '~> 2.4' # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html From 54025a5aa460bd28f915e2e3a727afe7d3dc2c16 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Wed, 6 Dec 2023 14:11:35 +0300 Subject: [PATCH 2/4] Fixes rubocop offenses --- lib/rabbit_carrots/tasks/rmq.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rabbit_carrots/tasks/rmq.rake b/lib/rabbit_carrots/tasks/rmq.rake index 6706b7b..a8c5830 100644 --- a/lib/rabbit_carrots/tasks/rmq.rake +++ b/lib/rabbit_carrots/tasks/rmq.rake @@ -5,10 +5,12 @@ namespace :rabbit_carrots do task eat: :environment do Rails.application.eager_load! + # rubocop:disable Lint/ConstantDefinitionInBlock DatabaseAgonsticNotNullViolation = defined?(ActiveRecord) ? ActiveRecord::NotNullViolation : RabbitCarrots::EventHandlers::Errors::PlaceholderError DatabaseAgonsticConnectionNotEstablished = defined?(ActiveRecord) ? ActiveRecord::ConnectionNotEstablished : Mongo::Error::SocketError DatabaseAgnosticRecordInvalid = defined?(ActiveRecord) ? ActiveRecord::RecordInvalid : Mongoid::Errors::Validations - + # rubocop:enable Lint/ConstantDefinitionInBlock + channels = RabbitCarrots.configuration.routing_key_mappings.map do |mapping| # This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant { **mapping, handler: mapping[:handler].constantize } @@ -32,7 +34,7 @@ namespace :rabbit_carrots do end end -def run_task(queue_name:, queue_arguments: {}, handler_class:, routing_keys:) +def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}) RabbitCarrots::Connection.instance.channel.with do |channel| exchange = channel.topic(RabbitCarrots.configuration.event_bus_exchange_name, durable: true) From 6b6da5e5cb3c6bc0a8cdb9760b87e6e014d9286f Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Wed, 6 Dec 2023 14:11:50 +0300 Subject: [PATCH 3/4] Bumps gem version --- lib/rabbit_carrots/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rabbit_carrots/version.rb b/lib/rabbit_carrots/version.rb index 4bf82fb..e036b5e 100644 --- a/lib/rabbit_carrots/version.rb +++ b/lib/rabbit_carrots/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RabbitCarrots - VERSION = '0.1.19' + VERSION = '0.1.20' end From 7c4c7ea08f80e687b24ba5ab48ec9aa0d61233d8 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Wed, 6 Dec 2023 14:26:16 +0300 Subject: [PATCH 4/4] Renames `event_bus_exchange_name` to `rabbitmq_exchange_name` for consistency --- README.md | 2 +- lib/rabbit_carrots/configuration.rb | 2 +- lib/rabbit_carrots/tasks/rmq.rake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50ead91..9c685f6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ RabbitCarrots.configure do |c| c.rabbitmq_user = ENV.fetch('RABBITMQ__USER', nil) c.rabbitmq_password = ENV.fetch('RABBITMQ__PASSWORD', nil) c.rabbitmq_vhost = ENV.fetch('RABBITMQ__VHOST', nil) - c.event_bus_exchange_name = ENV.fetch('EVENTBUS__EXCHANGE_NAME', nil) + c.rabbitmq_exchange_name = ENV.fetch('RABBITMQ__EXCHANGE_NAME', nil) c.routing_key_mappings = [ { routing_keys: ['RK1', 'RK2'], queue: 'QUEUE_NAME', handler: 'CLASS HANDLER IN STRING' }, { routing_keys: ['RK1', 'RK2'], queue: 'QUEUE_NAME', handler: 'CLASS HANDLER IN STRING' } diff --git a/lib/rabbit_carrots/configuration.rb b/lib/rabbit_carrots/configuration.rb index b861a1e..410561a 100644 --- a/lib/rabbit_carrots/configuration.rb +++ b/lib/rabbit_carrots/configuration.rb @@ -9,6 +9,6 @@ module RabbitCarrots end class Configuration - attr_accessor :rabbitmq_host, :rabbitmq_port, :rabbitmq_user, :rabbitmq_password, :rabbitmq_vhost, :routing_key_mappings, :event_bus_exchange_name + attr_accessor :rabbitmq_host, :rabbitmq_port, :rabbitmq_user, :rabbitmq_password, :rabbitmq_vhost, :routing_key_mappings, :rabbitmq_exchange_name end end diff --git a/lib/rabbit_carrots/tasks/rmq.rake b/lib/rabbit_carrots/tasks/rmq.rake index a8c5830..541f45b 100644 --- a/lib/rabbit_carrots/tasks/rmq.rake +++ b/lib/rabbit_carrots/tasks/rmq.rake @@ -36,7 +36,7 @@ end def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}) RabbitCarrots::Connection.instance.channel.with do |channel| - exchange = channel.topic(RabbitCarrots.configuration.event_bus_exchange_name, durable: true) + exchange = channel.topic(RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true) Rails.logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}" queue = channel.queue(queue_name, durable: true, arguments: queue_arguments)