rabbit_carrots 0.1.14 → 0.1.15

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: 8e9ab2a20f355e4ca1f3cca3ebc0c809650de453d2cbdbe80f9cd5255920fd7b
4
- data.tar.gz: f3b1ec00ac41796b70db5ad89ac17e4d170b5372575ca281ec0b55737abad6e2
3
+ metadata.gz: 6789a2811a7f1c151591246c4e0499c6ee5646afcf2a3127e6b6e845c66bf40b
4
+ data.tar.gz: b957f04668bc4f790478facd3a0737fea6779b5938f0d640b7b1d7edd36d8d95
5
5
  SHA512:
6
- metadata.gz: cb1e241226b30bd1c2f8abcbc0b7adc355addcb9a6cdfd6d3bf1f995b1f457a328b9f4d7633fa56018c98c8a87062e622c84caaf8f3df78fe866941ba06ea680
7
- data.tar.gz: f36e5866e32477b3a130c1ecd34876961fc78a58a2ab7d562b2f8338436e6fe6b1be9e8af2bbc5f6bf3c38c52b4f76799201c2e5610c1fbbcc9aeed3180bb051
6
+ metadata.gz: 9a6c24f33e2490508340601b680be096d88cb97c98a656912f7cc114e3ff662fbc77958d26df05d36353140f1541534ac357a0b41f9cc07b95564130b67fbb53
7
+ data.tar.gz: 6fc7bb72c7bdafb129a200683e1b0c5822ab1e418ebfae38ce63a3aa37c344f191037eab7a379f9c136f07a2c6bcfd9b4b8becf9a06988afc5b2d8dc31c20fa7
data/Gemfile CHANGED
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in rabbit_carrots.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ gem 'rake', '~> 13.0'
9
9
 
10
- gem "rspec", "~> 3.0"
10
+ gem 'rspec', '~> 3.0'
11
11
 
12
- gem "rubocop", "~> 1.21"
12
+ gem 'rubocop', '~> 1.21'
13
+
14
+ gem 'rubocop-rails', '~> 2.17'
data/Gemfile.lock CHANGED
@@ -1,24 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbit_carrots (0.1.14)
4
+ rabbit_carrots (0.1.15)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ activesupport (7.0.4)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
11
16
  amq-protocol (2.3.2)
12
17
  ast (2.4.2)
13
18
  bunny (2.19.0)
14
19
  amq-protocol (~> 2.3, >= 2.3.1)
15
20
  sorted_set (~> 1, >= 1.0.2)
21
+ concurrent-ruby (1.1.10)
16
22
  connection_pool (2.3.0)
17
23
  diff-lcs (1.5.0)
24
+ i18n (1.12.0)
25
+ concurrent-ruby (~> 1.0)
18
26
  json (2.6.2)
27
+ minitest (5.16.3)
19
28
  parallel (1.22.1)
20
29
  parser (3.1.2.1)
21
30
  ast (~> 2.4.1)
31
+ rack (3.0.1)
22
32
  rainbow (3.1.1)
23
33
  rake (13.0.6)
24
34
  rbtree (0.4.5)
@@ -49,11 +59,17 @@ GEM
49
59
  unicode-display_width (>= 1.4.0, < 3.0)
50
60
  rubocop-ast (1.23.0)
51
61
  parser (>= 3.1.1.0)
62
+ rubocop-rails (2.17.3)
63
+ activesupport (>= 4.2.0)
64
+ rack (>= 1.1)
65
+ rubocop (>= 1.33.0, < 2.0)
52
66
  ruby-progressbar (1.11.0)
53
67
  set (1.0.3)
54
68
  sorted_set (1.0.3)
55
69
  rbtree
56
70
  set (~> 1.0)
71
+ tzinfo (2.0.5)
72
+ concurrent-ruby (~> 1.0)
57
73
  unicode-display_width (2.3.0)
58
74
 
59
75
  PLATFORMS
@@ -64,6 +80,7 @@ DEPENDENCIES
64
80
  rake (~> 13.0)
65
81
  rspec (~> 3.0)
66
82
  rubocop (~> 1.21)
83
+ rubocop-rails (~> 2.17)
67
84
 
68
85
  BUNDLED WITH
69
- 2.3.23
86
+ 2.3.26
data/README.md CHANGED
@@ -43,6 +43,28 @@ end
43
43
 
44
44
 
45
45
 
46
+ Note that handler is a class that must implement a method named ```handle!``` that takes 4 parameters as follow:
47
+
48
+ ```ruby
49
+ class DummyEventHandler
50
+ def self.handle!(channel, delivery_info, properties, payload)
51
+ # Handle the received message from the queue
52
+ end
53
+ end
54
+ ```
55
+
56
+
57
+
58
+ Inside the handle message, you can NACK the message without re-queuing by raising ```RabbitCarrots::EventHandlers::Errors::NackMessage``` exception.
59
+
60
+ To NACK and re-queue, raise ```RabbitCarrots::EventHandlers::Errors::NackAndRequeueMessage``` exception.
61
+
62
+ If no errors are thrown, the message will be acknowledged soon after the ```handle!``` method returns.
63
+
64
+ Note: Any other unrescued exception raised inside ```handle!``` the that is a subclass of ```StandardError``` will trigger a NACK and re-queue.
65
+
66
+ ### Running
67
+
46
68
  Then run ```bundle exec rake rabbit_carrots:eat```.
47
69
 
48
70
  ## Development
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require "rubocop/rake_task"
8
+ require 'rubocop/rake_task'
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
@@ -4,7 +4,7 @@ module RabbitCarrots
4
4
  class Connection
5
5
  include ::Singleton
6
6
  attr_reader :connection
7
-
7
+
8
8
  def initialize
9
9
  @connection = Bunny.new(
10
10
  host: RabbitCarrots.configuration.rabbitmq_host,
@@ -16,11 +16,11 @@ module RabbitCarrots
16
16
 
17
17
  @connection.start
18
18
  end
19
-
19
+
20
20
  def channel
21
21
  @channel ||= ConnectionPool.new do
22
22
  connection.create_channel
23
23
  end
24
24
  end
25
- end
25
+ end
26
26
  end
@@ -10,4 +10,4 @@ module RabbitCarrots
10
10
  Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -10,7 +10,7 @@ namespace :rabbit_carrots do
10
10
  { **mapping, handler: mapping[:handler].constantize }
11
11
  end
12
12
 
13
- Rails.logger = Logger.new($stdout)
13
+ Rails.logger = Logger.new(Rails.env.production? ? '/proc/self/fd/1' : $stdout)
14
14
 
15
15
  # Run RMQ Subscriber for each channel
16
16
  channels.each do |channel|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RabbitCarrots
4
- VERSION = "0.1.14"
4
+ VERSION = '0.1.15'
5
5
  end
@@ -1,24 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "rabbit_carrots/version"
3
+ require_relative 'rabbit_carrots/version'
4
4
  require 'rabbit_carrots/connection'
5
5
  require 'rabbit_carrots/configuration'
6
6
  require 'rabbit_carrots/railtie' if defined?(Rails)
7
7
 
8
-
9
8
  module RabbitCarrots
10
9
  class Error < StandardError; end
10
+
11
11
  module EventHandlers
12
12
  module Errors
13
13
  class IrrelevantMessage < StandardError
14
14
  end
15
-
15
+
16
16
  class NackMessage < StandardError
17
17
  end
18
-
18
+
19
19
  class NackAndRequeueMessage < StandardError
20
20
  end
21
21
  end
22
22
  end
23
-
24
23
  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.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brusk Awat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -69,6 +69,7 @@ metadata:
69
69
  homepage_uri: https://github.com/ditkrg
70
70
  source_code_uri: https://github.com/ditkrg/rabbit_carrots
71
71
  changelog_uri: https://github.com/ditkrg/rabbit_carrots
72
+ rubygems_mfa_required: 'true'
72
73
  post_install_message:
73
74
  rdoc_options: []
74
75
  require_paths: