dispatch-rider 1.2.10 → 1.2.11
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/demultiplexer.rb +3 -1
- data/lib/dispatch-rider/publisher/base.rb +10 -0
- data/lib/dispatch-rider/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 391266fef437c97397d82c0c1e4c4011b52b5019
|
4
|
+
data.tar.gz: 49b5b5f512db78213c595b1c891ad23b8969caa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3c0bfa5f3eec6fc99433b7de1e0f5b9ff1c919af0e6b4336bfe6421b460acc7184c807c0e8cf55eec61a6467a830634f4240aec76440fce859e8cd4a43f5b2d
|
7
|
+
data.tar.gz: fe2777c3d655bf5a3540da763226e5a707543295bf9c5d4867918b21bf5f5d2f81620d77a15eca0ce5e9b3804647d6d0b9ca8fb707874d6f1f818ab41c842e81
|
@@ -42,10 +42,12 @@ module DispatchRider
|
|
42
42
|
|
43
43
|
def with_current_message(message)
|
44
44
|
@current_message = message
|
45
|
-
yield
|
45
|
+
result = yield
|
46
46
|
@current_message = nil
|
47
|
+
result
|
47
48
|
end
|
48
49
|
|
50
|
+
# This needs to return true/false based on the success of the jobs!
|
49
51
|
def dispatch_message(message)
|
50
52
|
with_current_message(message) do
|
51
53
|
dispatcher.dispatch(message)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
1
3
|
module DispatchRider
|
2
4
|
class Publisher::Base
|
3
5
|
|
@@ -26,9 +28,17 @@ module DispatchRider
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def publish(body)
|
31
|
+
raise ArgumentError, 'body should be a hash' unless body.kind_of?(Hash)
|
32
|
+
body = body.merge({
|
33
|
+
'guid' => self.class.generate_new_message_id,
|
34
|
+
})
|
29
35
|
publisher.publish(destinations: destinations, message: { subject: subject, body: body })
|
30
36
|
end
|
31
37
|
|
38
|
+
def self.generate_new_message_id
|
39
|
+
SecureRandom.uuid
|
40
|
+
end
|
41
|
+
|
32
42
|
private
|
33
43
|
|
34
44
|
def publisher
|