rabbit_messaging 0.8.1 → 0.9.0

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: 4cad15ae9d132080bcf28a14883df7a97a5f010bc87e32b7904467d136404741
4
- data.tar.gz: bd799cfe37ffd1ef3d8b139fae8440807efe44a10fe886d19b3a2cdfaac9426b
3
+ metadata.gz: cd0a35e07052f1d33c73f5ca2f411d6642f59bcb7c1893097209cde42f056f1c
4
+ data.tar.gz: 9e677dc5ddcb0f29ccf34942729af2b695c0e26f4e8db350923aa4d173e6990f
5
5
  SHA512:
6
- metadata.gz: e417cacf4032d25f7452e77eb9f2bd966f5933f1d6fc0334c785b34ba482824d8920f548dc8ce848be7db969c75f0496d22e6554b2cf65cf59a60b7290046486
7
- data.tar.gz: 4843680308d9d9c882fad903d003f4b973fc23860af14c8a3f29138187726cba6182974a91eed83cd723e73d9223b6d4b8710f0c05fe8d0af3223519296d77b9
6
+ metadata.gz: c25489a4ca2a39ee509d8dbc479480400ec61c2f20b7b63677c77ff61aa1118c0550a51cfa56a9ccf4e6803a990255e04098984752a712cb32b4d1e7e7e14e95
7
+ data.tar.gz: 4cc37ce72c23a40534f9fb7d30ac3b2a73516eb50d8e6beeba965ea908b23ef2bce684a04eb5ed260bd8e07f1fb6978fddabde24a8628fb6dc9edb87e023d38c
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.9.0] - 2020-11-18
5
+ ### Added
6
+ - configurable publish skipping (previous iteration just skipped in development)
7
+
8
+ ### Fixed
9
+ - fix for receiving (delivery_info and args to hashes)
10
+ - fix for requiring receiving job
11
+
4
12
  ## [0.8.1] - 2020-11-05
5
13
  ### Added
6
14
  - channels pool for manage channels on Publisher connection
data/README.md CHANGED
@@ -58,6 +58,13 @@ require "rabbit_messaging"
58
58
  * `:development` environment auto-creates queues and uses default exchange
59
59
  * `:production` environment enables handlers caching and gets maximum strictness
60
60
 
61
+ By default gem skips publishing in test and development environments.
62
+ If you want to change that then manually set `Rabbit.skip_publishing_in` with an array of environments.
63
+
64
+ ```ruby
65
+ Rabbit.skip_publishing_in = %i[test]
66
+ ```
67
+
61
68
  * `receiving_job_class_callable` (`Proc`)
62
69
 
63
70
  Custom ActiveJob subclass to work with received messages.
@@ -25,6 +25,7 @@ module Rabbit
25
25
  attribute :exception_notifier, default: -> { default_exception_notifier }
26
26
  attribute :before_receiving_hooks, default: []
27
27
  attribute :after_receiving_hooks, default: []
28
+ attribute :skip_publishing_in, default: %i[test development]
28
29
 
29
30
  attribute :receive_logger, default: lambda {
30
31
  Logger.new(Rails.root.join("log", "incoming_rabbit_messages.log"))
@@ -47,6 +48,10 @@ module Rabbit
47
48
  end
48
49
  end
49
50
 
51
+ def skip_publish?
52
+ skip_publishing_in.include?(environment)
53
+ end
54
+
50
55
  def app_name
51
56
  [group_id, project_id].join(".")
52
57
  end
@@ -11,7 +11,7 @@ module Rabbit
11
11
  MUTEX = Mutex.new
12
12
 
13
13
  def publish(msg)
14
- return if Rabbit.config.environment.in? %i[test development]
14
+ return if Rabbit.config.skip_publish?
15
15
 
16
16
  pool.with_channel msg.confirm_select? do |ch|
17
17
  ch.basic_publish *msg.basic_publish_args
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lamian"
4
+ require "active_job"
4
5
 
5
6
  require "rabbit"
6
7
  require "rabbit/receiving"
@@ -4,10 +4,9 @@ require "tainbox"
4
4
 
5
5
  require "rabbit"
6
6
  require "rabbit/receiving/queue"
7
+ require "rabbit/receiving/job"
7
8
 
8
9
  class Rabbit::Receiving::Receive
9
- autoload :Job, "rabbit/receiving/job"
10
-
11
10
  include Tainbox
12
11
 
13
12
  attribute :message
@@ -9,7 +9,8 @@ class Rabbit::Receiving::Worker
9
9
  include Sneakers::Worker
10
10
 
11
11
  def work_with_params(message, delivery_info, arguments)
12
- receive_message(message, delivery_info, arguments)
12
+ # args and info have custom rabbit classes, have to convert them to hash
13
+ receive_message(message, delivery_info.to_h, arguments.to_h)
13
14
  ack!
14
15
  rescue => error
15
16
  handle_error!(error)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rabbit
4
- VERSION = "0.8.1"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-06 00:00:00.000000000 Z
11
+ date: 2020-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny