dispatch-rider 1.2.11 → 1.3.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
  SHA1:
3
- metadata.gz: 391266fef437c97397d82c0c1e4c4011b52b5019
4
- data.tar.gz: 49b5b5f512db78213c595b1c891ad23b8969caa6
3
+ metadata.gz: e5b012324043e834bb969b954be7155db10dfef3
4
+ data.tar.gz: 518a531a1b759c8ec46c23f86fd00ca49c9a4f24
5
5
  SHA512:
6
- metadata.gz: a3c0bfa5f3eec6fc99433b7de1e0f5b9ff1c919af0e6b4336bfe6421b460acc7184c807c0e8cf55eec61a6467a830634f4240aec76440fce859e8cd4a43f5b2d
7
- data.tar.gz: fe2777c3d655bf5a3540da763226e5a707543295bf9c5d4867918b21bf5f5d2f81620d77a15eca0ce5e9b3804647d6d0b9ca8fb707874d6f1f818ab41c842e81
6
+ metadata.gz: 88725c8098ff777bf56e7db51652604cf1b32142a8816b74842c614be79133d3233851d0057d74c9ea1805d6b283d0d9d432488271a2aceb9fb9a380f964baeb
7
+ data.tar.gz: f5374cb26723f85e00c9041e82c7c9d718a1b535ba32894fb70bf30b192a11673bcc4ac1b95aff04a0c08f4a77148f23223ee5aa2d36eb13f87e0df4b0d4876b
@@ -23,6 +23,7 @@ module DispatchRider
23
23
  end
24
24
  end
25
25
 
26
+ require "dispatch-rider/debug"
26
27
  require "dispatch-rider/signal_tools"
27
28
  require "dispatch-rider/errors"
28
29
  require "dispatch-rider/error_handlers"
@@ -1,6 +1,6 @@
1
1
  module DispatchRider
2
2
  class Configuration
3
- attr_accessor :handler_path, :error_handler, :queue_info, :queue_kind, :subscriber, :logger
3
+ attr_accessor :handler_path, :error_handler, :queue_info, :queue_kind, :subscriber, :logger, :debug
4
4
  attr_reader :callbacks
5
5
 
6
6
  def initialize
@@ -11,6 +11,7 @@ module DispatchRider
11
11
  @callbacks = Callbacks::Storage.new
12
12
  @subscriber = DispatchRider::Subscriber
13
13
  @logger = Logger.new(STDERR)
14
+ @debug = false
14
15
  end
15
16
 
16
17
  delegate :before, :after, :around, :to => :callbacks
@@ -0,0 +1,5 @@
1
+ module DispatchRider
2
+ module Debug
3
+ PUBLISHER_MESSAGE_GUID = 'test-mode-not-random-guid'.freeze
4
+ end
5
+ end
@@ -21,6 +21,16 @@ module DispatchRider
21
21
  raise NotImplementedError
22
22
  end
23
23
 
24
+ private
25
+
26
+ def generate_new_message_id
27
+ if DispatchRider.config.debug
28
+ DispatchRider::Debug::PUBLISHER_MESSAGE_GUID
29
+ else
30
+ SecureRandom.uuid
31
+ end
32
+ end
33
+
24
34
  end
25
35
 
26
36
  def initialize(publisher = nil)
@@ -30,17 +40,11 @@ module DispatchRider
30
40
  def publish(body)
31
41
  raise ArgumentError, 'body should be a hash' unless body.kind_of?(Hash)
32
42
  body = body.merge({
33
- 'guid' => self.class.generate_new_message_id,
43
+ 'guid' => generate_new_message_id,
34
44
  })
35
45
  publisher.publish(destinations: destinations, message: { subject: subject, body: body })
36
46
  end
37
47
 
38
- def self.generate_new_message_id
39
- SecureRandom.uuid
40
- end
41
-
42
- private
43
-
44
48
  def publisher
45
49
  @publisher || self.class.default_publisher
46
50
  end
@@ -53,5 +57,11 @@ module DispatchRider
53
57
  self.class.instance_variable_get(:@subject)
54
58
  end
55
59
 
60
+ private
61
+
62
+ def generate_new_message_id
63
+ self.class.send(:generate_new_message_id)
64
+ end
65
+
56
66
  end
57
67
  end
@@ -1,4 +1,4 @@
1
1
  # This file specifies the current version of the gem.
2
2
  module DispatchRider
3
- VERSION = "1.2.11"
3
+ VERSION = "1.3.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dispatch-rider
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.11
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suman Mukherjee
@@ -160,6 +160,7 @@ files:
160
160
  - lib/dispatch-rider/callbacks/storage.rb
161
161
  - lib/dispatch-rider/command.rb
162
162
  - lib/dispatch-rider/configuration.rb
163
+ - lib/dispatch-rider/debug.rb
163
164
  - lib/dispatch-rider/demultiplexer.rb
164
165
  - lib/dispatch-rider/dispatcher.rb
165
166
  - lib/dispatch-rider/error_handlers.rb