rabbit_carrots 0.1.19 → 0.1.20
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 +4 -4
- data/Gemfile.lock +45 -29
- data/README.md +1 -1
- data/lib/rabbit_carrots/configuration.rb +1 -1
- data/lib/rabbit_carrots/tasks/rmq.rake +5 -3
- data/lib/rabbit_carrots/version.rb +1 -1
- metadata +6 -7
- data/rabbit_carrots.gemspec +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e3aa34b3f6e19e3490fcba113867feb0326fd10e8597b9323d8f384a36caa55
|
|
4
|
+
data.tar.gz: 972c341f20e6bcd7d84c7cae441938f6f0f8fef2451bcb84f41f9e1d4b331e0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b6df93150a9535d8acff68628c548958e9f22f23cb87d183460d38672d0a135e718e840df92fd70899e2deea5e8482a17d11b5ae6b6862510a8bec3cc853855
|
|
7
|
+
data.tar.gz: 5100eab0c16d895dbc0c8e0dbf0217a49d2d37e965ab8a955c543eb657f87eab1b281d09c80908b641720b792a891cc1dd1d5db8b232144627410eea167e7bf0
|
data/Gemfile
CHANGED
|
@@ -5,10 +5,10 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in rabbit_carrots.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem 'rake', '~> 13.
|
|
8
|
+
gem 'rake', '~> 13.1'
|
|
9
9
|
|
|
10
|
-
gem 'rspec', '~> 3.
|
|
10
|
+
gem 'rspec', '~> 3.12'
|
|
11
11
|
|
|
12
|
-
gem 'rubocop', '~> 1.
|
|
12
|
+
gem 'rubocop', '~> 1.58'
|
|
13
13
|
|
|
14
|
-
gem 'rubocop-rails', '~> 2.
|
|
14
|
+
gem 'rubocop-rails', '~> 2.22'
|
data/Gemfile.lock
CHANGED
|
@@ -1,39 +1,52 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rabbit_carrots (0.1.
|
|
5
|
-
bunny (>= 2.
|
|
6
|
-
connection_pool (~> 2.
|
|
4
|
+
rabbit_carrots (0.1.20)
|
|
5
|
+
bunny (>= 2.22)
|
|
6
|
+
connection_pool (~> 2.4)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activesupport (7.
|
|
11
|
+
activesupport (7.1.2)
|
|
12
|
+
base64
|
|
13
|
+
bigdecimal
|
|
12
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
15
|
+
connection_pool (>= 2.2.5)
|
|
16
|
+
drb
|
|
13
17
|
i18n (>= 1.6, < 2)
|
|
14
18
|
minitest (>= 5.1)
|
|
19
|
+
mutex_m
|
|
15
20
|
tzinfo (~> 2.0)
|
|
16
21
|
amq-protocol (2.3.2)
|
|
17
22
|
ast (2.4.2)
|
|
23
|
+
base64 (0.2.0)
|
|
24
|
+
bigdecimal (3.1.4)
|
|
18
25
|
bunny (2.22.0)
|
|
19
26
|
amq-protocol (~> 2.3, >= 2.3.1)
|
|
20
27
|
sorted_set (~> 1, >= 1.0.2)
|
|
21
|
-
concurrent-ruby (1.
|
|
22
|
-
connection_pool (2.
|
|
28
|
+
concurrent-ruby (1.2.2)
|
|
29
|
+
connection_pool (2.4.1)
|
|
23
30
|
diff-lcs (1.5.0)
|
|
24
|
-
|
|
31
|
+
drb (2.2.0)
|
|
32
|
+
ruby2_keywords
|
|
33
|
+
i18n (1.14.1)
|
|
25
34
|
concurrent-ruby (~> 1.0)
|
|
26
|
-
json (2.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
json (2.7.1)
|
|
36
|
+
language_server-protocol (3.17.0.3)
|
|
37
|
+
minitest (5.20.0)
|
|
38
|
+
mutex_m (0.2.0)
|
|
39
|
+
parallel (1.23.0)
|
|
40
|
+
parser (3.2.2.4)
|
|
30
41
|
ast (~> 2.4.1)
|
|
31
|
-
|
|
42
|
+
racc
|
|
43
|
+
racc (1.7.3)
|
|
44
|
+
rack (3.0.8)
|
|
32
45
|
rainbow (3.1.1)
|
|
33
|
-
rake (13.0
|
|
46
|
+
rake (13.1.0)
|
|
34
47
|
rbtree (0.4.6)
|
|
35
|
-
regexp_parser (2.
|
|
36
|
-
rexml (3.2.
|
|
48
|
+
regexp_parser (2.8.3)
|
|
49
|
+
rexml (3.2.6)
|
|
37
50
|
rspec (3.12.0)
|
|
38
51
|
rspec-core (~> 3.12.0)
|
|
39
52
|
rspec-expectations (~> 3.12.0)
|
|
@@ -47,40 +60,43 @@ GEM
|
|
|
47
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
48
61
|
rspec-support (~> 3.12.0)
|
|
49
62
|
rspec-support (3.12.0)
|
|
50
|
-
rubocop (1.
|
|
63
|
+
rubocop (1.58.0)
|
|
51
64
|
json (~> 2.3)
|
|
65
|
+
language_server-protocol (>= 3.17.0)
|
|
52
66
|
parallel (~> 1.10)
|
|
53
|
-
parser (>= 3.
|
|
67
|
+
parser (>= 3.2.2.4)
|
|
54
68
|
rainbow (>= 2.2.2, < 4.0)
|
|
55
69
|
regexp_parser (>= 1.8, < 3.0)
|
|
56
70
|
rexml (>= 3.2.5, < 4.0)
|
|
57
|
-
rubocop-ast (>= 1.
|
|
71
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
|
58
72
|
ruby-progressbar (~> 1.7)
|
|
59
|
-
unicode-display_width (>=
|
|
60
|
-
rubocop-ast (1.
|
|
61
|
-
parser (>= 3.
|
|
62
|
-
rubocop-rails (2.
|
|
73
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
74
|
+
rubocop-ast (1.30.0)
|
|
75
|
+
parser (>= 3.2.1.0)
|
|
76
|
+
rubocop-rails (2.22.2)
|
|
63
77
|
activesupport (>= 4.2.0)
|
|
64
78
|
rack (>= 1.1)
|
|
65
79
|
rubocop (>= 1.33.0, < 2.0)
|
|
66
|
-
|
|
80
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
|
81
|
+
ruby-progressbar (1.13.0)
|
|
82
|
+
ruby2_keywords (0.0.5)
|
|
67
83
|
set (1.0.3)
|
|
68
84
|
sorted_set (1.0.3)
|
|
69
85
|
rbtree
|
|
70
86
|
set (~> 1.0)
|
|
71
|
-
tzinfo (2.0.
|
|
87
|
+
tzinfo (2.0.6)
|
|
72
88
|
concurrent-ruby (~> 1.0)
|
|
73
|
-
unicode-display_width (2.
|
|
89
|
+
unicode-display_width (2.5.0)
|
|
74
90
|
|
|
75
91
|
PLATFORMS
|
|
76
92
|
x86_64-linux
|
|
77
93
|
|
|
78
94
|
DEPENDENCIES
|
|
79
95
|
rabbit_carrots!
|
|
80
|
-
rake (~> 13.
|
|
81
|
-
rspec (~> 3.
|
|
82
|
-
rubocop (~> 1.
|
|
83
|
-
rubocop-rails (~> 2.
|
|
96
|
+
rake (~> 13.1)
|
|
97
|
+
rspec (~> 3.12)
|
|
98
|
+
rubocop (~> 1.58)
|
|
99
|
+
rubocop-rails (~> 2.22)
|
|
84
100
|
|
|
85
101
|
BUNDLED WITH
|
|
86
102
|
2.3.26
|
data/README.md
CHANGED
|
@@ -32,7 +32,7 @@ RabbitCarrots.configure do |c|
|
|
|
32
32
|
c.rabbitmq_user = ENV.fetch('RABBITMQ__USER', nil)
|
|
33
33
|
c.rabbitmq_password = ENV.fetch('RABBITMQ__PASSWORD', nil)
|
|
34
34
|
c.rabbitmq_vhost = ENV.fetch('RABBITMQ__VHOST', nil)
|
|
35
|
-
c.
|
|
35
|
+
c.rabbitmq_exchange_name = ENV.fetch('RABBITMQ__EXCHANGE_NAME', nil)
|
|
36
36
|
c.routing_key_mappings = [
|
|
37
37
|
{ routing_keys: ['RK1', 'RK2'], queue: 'QUEUE_NAME', handler: 'CLASS HANDLER IN STRING' },
|
|
38
38
|
{ routing_keys: ['RK1', 'RK2'], queue: 'QUEUE_NAME', handler: 'CLASS HANDLER IN STRING' }
|
|
@@ -9,6 +9,6 @@ module RabbitCarrots
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
class Configuration
|
|
12
|
-
attr_accessor :rabbitmq_host, :rabbitmq_port, :rabbitmq_user, :rabbitmq_password, :rabbitmq_vhost, :routing_key_mappings, :
|
|
12
|
+
attr_accessor :rabbitmq_host, :rabbitmq_port, :rabbitmq_user, :rabbitmq_password, :rabbitmq_vhost, :routing_key_mappings, :rabbitmq_exchange_name
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -5,10 +5,12 @@ namespace :rabbit_carrots do
|
|
|
5
5
|
task eat: :environment do
|
|
6
6
|
Rails.application.eager_load!
|
|
7
7
|
|
|
8
|
+
# rubocop:disable Lint/ConstantDefinitionInBlock
|
|
8
9
|
DatabaseAgonsticNotNullViolation = defined?(ActiveRecord) ? ActiveRecord::NotNullViolation : RabbitCarrots::EventHandlers::Errors::PlaceholderError
|
|
9
10
|
DatabaseAgonsticConnectionNotEstablished = defined?(ActiveRecord) ? ActiveRecord::ConnectionNotEstablished : Mongo::Error::SocketError
|
|
10
11
|
DatabaseAgnosticRecordInvalid = defined?(ActiveRecord) ? ActiveRecord::RecordInvalid : Mongoid::Errors::Validations
|
|
11
|
-
|
|
12
|
+
# rubocop:enable Lint/ConstantDefinitionInBlock
|
|
13
|
+
|
|
12
14
|
channels = RabbitCarrots.configuration.routing_key_mappings.map do |mapping|
|
|
13
15
|
# This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant
|
|
14
16
|
{ **mapping, handler: mapping[:handler].constantize }
|
|
@@ -32,9 +34,9 @@ namespace :rabbit_carrots do
|
|
|
32
34
|
end
|
|
33
35
|
end
|
|
34
36
|
|
|
35
|
-
def run_task(queue_name:, queue_arguments: {}
|
|
37
|
+
def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {})
|
|
36
38
|
RabbitCarrots::Connection.instance.channel.with do |channel|
|
|
37
|
-
exchange = channel.topic(RabbitCarrots.configuration.
|
|
39
|
+
exchange = channel.topic(RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true)
|
|
38
40
|
|
|
39
41
|
Rails.logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}"
|
|
40
42
|
queue = channel.queue(queue_name, durable: true, arguments: queue_arguments)
|
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.
|
|
4
|
+
version: 0.1.20
|
|
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-
|
|
11
|
+
date: 2023-12-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bunny
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.
|
|
19
|
+
version: '2.22'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.
|
|
26
|
+
version: '2.22'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: connection_pool
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 2.
|
|
33
|
+
version: '2.4'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 2.
|
|
40
|
+
version: '2.4'
|
|
41
41
|
description: A background task based on rake to consume RabbitMQ messages
|
|
42
42
|
email:
|
|
43
43
|
- broosk.edogawa@gmail.com
|
|
@@ -60,7 +60,6 @@ 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
|
|
64
63
|
- sig/rabbit_carrots.rbs
|
|
65
64
|
homepage: https://github.com/ditkrg
|
|
66
65
|
licenses:
|
data/rabbit_carrots.gemspec
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|