rabbit_carrots 1.0.6 → 1.1.0
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/.rubocop.yml +6 -3
- data/Gemfile +4 -4
- data/Gemfile.lock +66 -56
- data/lib/puma/plugin/rabbit_carrots.rb +3 -2
- data/lib/rabbit_carrots/configuration.rb +1 -3
- data/lib/rabbit_carrots/connection.rb +1 -0
- data/lib/rabbit_carrots/core.rb +4 -3
- data/lib/rabbit_carrots/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8e5f321b0b92e7e1c3f1926e28b692398fd453e22c591ad0715fa7bc93b1b34
|
|
4
|
+
data.tar.gz: 5be7f4d4378c6a0fdc4f2edbec9fd438dca66a98ec1b9659d6a6a44d8d4d3cb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83bde341ce60aaaee1bcfd1c323484641fcfbc7e2d8b74fcd34ef0afe7eb91dc9d332254f34049dfe5b24120bfb717bf1d7cdc758130481059fcd9b1b5a7d848
|
|
7
|
+
data.tar.gz: 585ff0eb908008acdc9b323dd138dcb676955c2c87586f62d71d7926c534cfe988c1e071ae2b308455299a3a1672123ea054a5a70f2abea3194fad2456f38af4
|
data/.rubocop.yml
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rails
|
|
2
3
|
|
|
3
4
|
AllCops:
|
|
4
5
|
NewCops: enable
|
|
5
6
|
SuggestExtensions: false
|
|
6
7
|
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
|
7
8
|
Enabled: true
|
|
8
|
-
Layout/LineLength:
|
|
9
|
+
Layout/LineLength:
|
|
9
10
|
Max: 350
|
|
10
11
|
Lint/AmbiguousAssignment: # (new in 1.7)
|
|
11
12
|
Enabled: true
|
|
@@ -110,4 +111,6 @@ Metrics/MethodLength:
|
|
|
110
111
|
Metrics/CyclomaticComplexity:
|
|
111
112
|
Max: 15
|
|
112
113
|
Metrics/PerceivedComplexity:
|
|
113
|
-
Max: 15
|
|
114
|
+
Max: 15
|
|
115
|
+
Metrics/ParameterLists:
|
|
116
|
+
Max: 6
|
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.1'
|
|
8
|
+
gem 'rake', '~> 13.3.1'
|
|
9
9
|
|
|
10
|
-
gem 'rspec', '~> 3.
|
|
10
|
+
gem 'rspec', '~> 3.13.2'
|
|
11
11
|
|
|
12
|
-
gem 'rubocop', '~> 1.
|
|
12
|
+
gem 'rubocop', '~> 1.82.1'
|
|
13
13
|
|
|
14
|
-
gem 'rubocop-rails', '~> 2.
|
|
14
|
+
gem 'rubocop-rails', '~> 2.34.3'
|
data/Gemfile.lock
CHANGED
|
@@ -1,102 +1,112 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rabbit_carrots (1.0
|
|
4
|
+
rabbit_carrots (1.1.0)
|
|
5
5
|
bunny (>= 2.22)
|
|
6
|
-
connection_pool (
|
|
6
|
+
connection_pool (>= 2.4)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activesupport (
|
|
11
|
+
activesupport (8.1.2)
|
|
12
12
|
base64
|
|
13
13
|
bigdecimal
|
|
14
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
15
15
|
connection_pool (>= 2.2.5)
|
|
16
16
|
drb
|
|
17
17
|
i18n (>= 1.6, < 2)
|
|
18
|
+
json
|
|
19
|
+
logger (>= 1.4.2)
|
|
18
20
|
minitest (>= 5.1)
|
|
19
|
-
|
|
20
|
-
tzinfo (~> 2.0)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
securerandom (>= 0.3)
|
|
22
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
23
|
+
uri (>= 0.13.1)
|
|
24
|
+
amq-protocol (2.5.0)
|
|
25
|
+
ast (2.4.3)
|
|
26
|
+
base64 (0.3.0)
|
|
27
|
+
bigdecimal (4.0.1)
|
|
25
28
|
bunny (2.24.0)
|
|
26
29
|
amq-protocol (~> 2.3)
|
|
27
30
|
sorted_set (~> 1, >= 1.0.2)
|
|
28
|
-
concurrent-ruby (1.
|
|
29
|
-
connection_pool (
|
|
30
|
-
diff-lcs (1.
|
|
31
|
-
drb (2.2.
|
|
32
|
-
|
|
33
|
-
i18n (1.14.1)
|
|
31
|
+
concurrent-ruby (1.3.6)
|
|
32
|
+
connection_pool (3.0.2)
|
|
33
|
+
diff-lcs (1.6.2)
|
|
34
|
+
drb (2.2.3)
|
|
35
|
+
i18n (1.14.8)
|
|
34
36
|
concurrent-ruby (~> 1.0)
|
|
35
|
-
json (2.
|
|
36
|
-
language_server-protocol (3.17.0.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
json (2.18.0)
|
|
38
|
+
language_server-protocol (3.17.0.5)
|
|
39
|
+
lint_roller (1.1.0)
|
|
40
|
+
logger (1.7.0)
|
|
41
|
+
minitest (6.0.1)
|
|
42
|
+
prism (~> 1.5)
|
|
43
|
+
parallel (1.27.0)
|
|
44
|
+
parser (3.3.10.1)
|
|
41
45
|
ast (~> 2.4.1)
|
|
42
46
|
racc
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
prism (1.8.0)
|
|
48
|
+
racc (1.8.1)
|
|
49
|
+
rack (3.2.4)
|
|
45
50
|
rainbow (3.1.1)
|
|
46
|
-
rake (13.1
|
|
51
|
+
rake (13.3.1)
|
|
47
52
|
rbtree (0.4.6)
|
|
48
|
-
regexp_parser (2.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
rspec-
|
|
52
|
-
rspec-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
rspec-expectations (3.12.0)
|
|
53
|
+
regexp_parser (2.11.3)
|
|
54
|
+
rspec (3.13.2)
|
|
55
|
+
rspec-core (~> 3.13.0)
|
|
56
|
+
rspec-expectations (~> 3.13.0)
|
|
57
|
+
rspec-mocks (~> 3.13.0)
|
|
58
|
+
rspec-core (3.13.6)
|
|
59
|
+
rspec-support (~> 3.13.0)
|
|
60
|
+
rspec-expectations (3.13.5)
|
|
57
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
58
|
-
rspec-support (~> 3.
|
|
59
|
-
rspec-mocks (3.
|
|
62
|
+
rspec-support (~> 3.13.0)
|
|
63
|
+
rspec-mocks (3.13.7)
|
|
60
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
|
-
rspec-support (~> 3.
|
|
62
|
-
rspec-support (3.
|
|
63
|
-
rubocop (1.
|
|
65
|
+
rspec-support (~> 3.13.0)
|
|
66
|
+
rspec-support (3.13.6)
|
|
67
|
+
rubocop (1.82.1)
|
|
64
68
|
json (~> 2.3)
|
|
65
|
-
language_server-protocol (
|
|
69
|
+
language_server-protocol (~> 3.17.0.2)
|
|
70
|
+
lint_roller (~> 1.1.0)
|
|
66
71
|
parallel (~> 1.10)
|
|
67
|
-
parser (>= 3.
|
|
72
|
+
parser (>= 3.3.0.2)
|
|
68
73
|
rainbow (>= 2.2.2, < 4.0)
|
|
69
|
-
regexp_parser (>=
|
|
70
|
-
|
|
71
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
|
74
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
75
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
72
76
|
ruby-progressbar (~> 1.7)
|
|
73
|
-
unicode-display_width (>= 2.4.0, <
|
|
74
|
-
rubocop-ast (1.
|
|
75
|
-
parser (>= 3.
|
|
76
|
-
|
|
77
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
78
|
+
rubocop-ast (1.49.0)
|
|
79
|
+
parser (>= 3.3.7.2)
|
|
80
|
+
prism (~> 1.7)
|
|
81
|
+
rubocop-rails (2.34.3)
|
|
77
82
|
activesupport (>= 4.2.0)
|
|
83
|
+
lint_roller (~> 1.1)
|
|
78
84
|
rack (>= 1.1)
|
|
79
|
-
rubocop (>= 1.
|
|
80
|
-
rubocop-ast (>= 1.
|
|
85
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
86
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
|
81
87
|
ruby-progressbar (1.13.0)
|
|
82
|
-
|
|
88
|
+
securerandom (0.4.1)
|
|
83
89
|
set (1.1.2)
|
|
84
90
|
sorted_set (1.0.3)
|
|
85
91
|
rbtree
|
|
86
92
|
set (~> 1.0)
|
|
87
93
|
tzinfo (2.0.6)
|
|
88
94
|
concurrent-ruby (~> 1.0)
|
|
89
|
-
unicode-display_width (2.
|
|
95
|
+
unicode-display_width (3.2.0)
|
|
96
|
+
unicode-emoji (~> 4.1)
|
|
97
|
+
unicode-emoji (4.2.0)
|
|
98
|
+
uri (1.1.1)
|
|
90
99
|
|
|
91
100
|
PLATFORMS
|
|
101
|
+
arm64-darwin-25
|
|
92
102
|
x86_64-linux
|
|
93
103
|
|
|
94
104
|
DEPENDENCIES
|
|
95
105
|
rabbit_carrots!
|
|
96
|
-
rake (~> 13.1)
|
|
97
|
-
rspec (~> 3.
|
|
98
|
-
rubocop (~> 1.
|
|
99
|
-
rubocop-rails (~> 2.
|
|
106
|
+
rake (~> 13.3.1)
|
|
107
|
+
rspec (~> 3.13.2)
|
|
108
|
+
rubocop (~> 1.82.1)
|
|
109
|
+
rubocop-rails (~> 2.34.3)
|
|
100
110
|
|
|
101
111
|
BUNDLED WITH
|
|
102
112
|
2.3.26
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# rabbit_carrots.rb
|
|
2
|
+
require 'English'
|
|
2
3
|
require 'puma/plugin'
|
|
3
4
|
require 'rabbit_carrots'
|
|
4
5
|
|
|
@@ -7,7 +8,7 @@ Puma::Plugin.create do
|
|
|
7
8
|
|
|
8
9
|
def start(launcher)
|
|
9
10
|
@log_writer = launcher.log_writer
|
|
10
|
-
@puma_pid =
|
|
11
|
+
@puma_pid = $PROCESS_ID
|
|
11
12
|
|
|
12
13
|
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
|
13
14
|
|
|
@@ -57,7 +58,7 @@ Puma::Plugin.create do
|
|
|
57
58
|
loop do
|
|
58
59
|
if send(process_dead)
|
|
59
60
|
log message
|
|
60
|
-
Process.kill('TERM',
|
|
61
|
+
Process.kill('TERM', $PROCESS_ID)
|
|
61
62
|
break
|
|
62
63
|
end
|
|
63
64
|
sleep 2
|
data/lib/rabbit_carrots/core.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module RabbitCarrots
|
|
2
|
-
class Core
|
|
2
|
+
class Core # rubocop:disable Metrics/ClassLength
|
|
3
3
|
attr_reader :logger
|
|
4
4
|
|
|
5
5
|
@database_agnostic_not_null_violation = nil
|
|
@@ -36,6 +36,7 @@ module RabbitCarrots
|
|
|
36
36
|
handler_class:,
|
|
37
37
|
routing_keys: channel[:routing_keys],
|
|
38
38
|
queue_arguments: channel[:arguments],
|
|
39
|
+
exchange_name: channel[:exchange_name],
|
|
39
40
|
kill_to_restart_on_standard_error:
|
|
40
41
|
)
|
|
41
42
|
end
|
|
@@ -76,9 +77,9 @@ module RabbitCarrots
|
|
|
76
77
|
@running = false
|
|
77
78
|
end
|
|
78
79
|
|
|
79
|
-
def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}, kill_to_restart_on_standard_error: false)
|
|
80
|
+
def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}, exchange_name: nil, kill_to_restart_on_standard_error: false)
|
|
80
81
|
RabbitCarrots::Connection.instance.channel.with do |channel|
|
|
81
|
-
exchange = channel.topic(RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true)
|
|
82
|
+
exchange = channel.topic(exchange_name || RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true)
|
|
82
83
|
|
|
83
84
|
logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}"
|
|
84
85
|
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: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brusk Awat
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bunny
|
|
@@ -28,14 +28,14 @@ dependencies:
|
|
|
28
28
|
name: connection_pool
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
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
40
|
version: '2.4'
|
|
41
41
|
description: A background task based on rake to consume RabbitMQ messages
|