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 +4 -4
- data/lib/dispatch-rider.rb +1 -0
- data/lib/dispatch-rider/configuration.rb +2 -1
- data/lib/dispatch-rider/debug.rb +5 -0
- data/lib/dispatch-rider/publisher/base.rb +17 -7
- data/lib/dispatch-rider/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b012324043e834bb969b954be7155db10dfef3
|
4
|
+
data.tar.gz: 518a531a1b759c8ec46c23f86fd00ca49c9a4f24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88725c8098ff777bf56e7db51652604cf1b32142a8816b74842c614be79133d3233851d0057d74c9ea1805d6b283d0d9d432488271a2aceb9fb9a380f964baeb
|
7
|
+
data.tar.gz: f5374cb26723f85e00c9041e82c7c9d718a1b535ba32894fb70bf30b192a11673bcc4ac1b95aff04a0c08f4a77148f23223ee5aa2d36eb13f87e0df4b0d4876b
|
data/lib/dispatch-rider.rb
CHANGED
@@ -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
|
@@ -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' =>
|
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
|
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.
|
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
|