rabbit_carrots 0.1.18 → 0.1.19

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
  SHA256:
3
- metadata.gz: c9fb1f67171e4f18f2e1640592ce820233d76456b78b764e72f8b4a811b85383
4
- data.tar.gz: 535403deef2e78e75be7ddc1572bd7773d464b55061e5f3a7ac5265b5e37309c
3
+ metadata.gz: 38ce895e003d31b6ac01acc609a8a93821fdacacbf02b3f1f6249a20f612dc12
4
+ data.tar.gz: 153216b16ff4d597840a292f8eb1c124f65655555b1549f467508626fbd4d2b1
5
5
  SHA512:
6
- metadata.gz: d5f04fe09bbc7bb71fa85237e526cb011f039e6010547ab3d27de1abdb4b98892bf256cc33b380a353e7482852f3e90cd9fb7255f757a0391961ffa140e679d6
7
- data.tar.gz: 3b7c2b59a8bfd51d1ce2a26886afd46049df699f876e9afd2c810e22ad17e75e579e6790cc6db1b91dd45e6150fa73f5aaedcbe7f4968afc9daef9eaafe2e571
6
+ metadata.gz: 17736462ced2634012c25f26199e61dbf97fd1c88ee8b8895faee18ea27fb95734e726e62a9be088318edaeac44714536612aa22b5c6719c7750ed4cf7e8192f
7
+ data.tar.gz: 632b476993e5c84d7a6022c2e749a44ca74ff656cd6322e1601c04248faec32fc04390e2e061305b3dc883b40c94fbdc71bc89e0f298d3b0641d907312d97da6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbit_carrots (0.1.17)
4
+ rabbit_carrots (0.1.19)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
@@ -15,7 +15,7 @@ GEM
15
15
  tzinfo (~> 2.0)
16
16
  amq-protocol (2.3.2)
17
17
  ast (2.4.2)
18
- bunny (2.20.3)
18
+ bunny (2.22.0)
19
19
  amq-protocol (~> 2.3, >= 2.3.1)
20
20
  sorted_set (~> 1, >= 1.0.2)
21
21
  concurrent-ruby (1.1.10)
@@ -5,6 +5,10 @@ namespace :rabbit_carrots do
5
5
  task eat: :environment do
6
6
  Rails.application.eager_load!
7
7
 
8
+ DatabaseAgonsticNotNullViolation = defined?(ActiveRecord) ? ActiveRecord::NotNullViolation : RabbitCarrots::EventHandlers::Errors::PlaceholderError
9
+ DatabaseAgonsticConnectionNotEstablished = defined?(ActiveRecord) ? ActiveRecord::ConnectionNotEstablished : Mongo::Error::SocketError
10
+ DatabaseAgnosticRecordInvalid = defined?(ActiveRecord) ? ActiveRecord::RecordInvalid : Mongoid::Errors::Validations
11
+
8
12
  channels = RabbitCarrots.configuration.routing_key_mappings.map do |mapping|
9
13
  # This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant
10
14
  { **mapping, handler: mapping[:handler].constantize }
@@ -47,11 +51,11 @@ def run_task(queue_name:, queue_arguments: {}, handler_class:, routing_keys:)
47
51
  rescue RabbitCarrots::EventHandlers::Errors::NackAndRequeueMessage => _e
48
52
  Rails.logger.info "Nacked and Requeued message: #{payload}"
49
53
  channel.nack(delivery_info.delivery_tag, false, true)
50
- rescue ActiveRecord::NotNullViolation, ActiveRecord::RecordInvalid => e
54
+ rescue DatabaseAgonsticNotNullViolation, DatabaseAgnosticRecordInvalid => e
51
55
  # on null constraint violation, we want to ack the message
52
56
  Rails.logger.error "Null constraint or Invalid violation: #{payload}. Error: #{e.message}"
53
57
  channel.ack(delivery_info.delivery_tag, false)
54
- rescue ActiveRecord::ConnectionNotEstablished => e
58
+ rescue DatabaseAgonsticConnectionNotEstablished => e
55
59
  # on connection not established, we want to requeue the message and sleep for 3 seconds
56
60
  Rails.logger.error "Error connection not established to the database: #{payload}. Error: #{e.message}"
57
61
  # delay for 3 seconds before requeuing
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RabbitCarrots
4
- VERSION = '0.1.18'
4
+ VERSION = '0.1.19'
5
5
  end
@@ -18,6 +18,8 @@ module RabbitCarrots
18
18
 
19
19
  class NackAndRequeueMessage < StandardError
20
20
  end
21
+
22
+ class PlaceholderError < Error; end
21
23
  end
22
24
  end
23
25
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rabbit_carrots/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rabbit_carrots'
7
+ spec.version = RabbitCarrots::VERSION
8
+ spec.authors = ['Brusk Awat']
9
+ spec.email = ['broosk.edogawa@gmail.com']
10
+
11
+ spec.summary = 'A simple RabbitMQ consumer task'
12
+ spec.description = 'A background task based on rake to consume RabbitMQ messages'
13
+ spec.homepage = 'https://github.com/ditkrg'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 3.1.0'
16
+
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
+
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = 'https://github.com/ditkrg/rabbit_carrots'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/ditkrg/rabbit_carrots'
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ spec.add_dependency 'bunny', '>= 2.19.0'
36
+ spec.add_dependency 'connection_pool', '~> 2.3.0'
37
+
38
+ # For more information and examples about making a new gem, check out our
39
+ # guide at: https://bundler.io/guides/creating_gem.html
40
+ spec.metadata['rubygems_mfa_required'] = 'true'
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_carrots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brusk Awat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -60,6 +60,7 @@ files:
60
60
  - lib/rabbit_carrots/railtie.rb
61
61
  - lib/rabbit_carrots/tasks/rmq.rake
62
62
  - lib/rabbit_carrots/version.rb
63
+ - rabbit_carrots.gemspec
63
64
  - sig/rabbit_carrots.rbs
64
65
  homepage: https://github.com/ditkrg
65
66
  licenses:
@@ -85,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  requirements: []
88
- rubygems_version: 3.4.1
89
+ rubygems_version: 3.4.19
89
90
  signing_key:
90
91
  specification_version: 4
91
92
  summary: A simple RabbitMQ consumer task