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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8c29195d3bd8c808f9ab98c9611768cea844e9b
4
- data.tar.gz: a0b4b374d0561ec0b2d39d78cea4c1caa61e5e2f
3
+ metadata.gz: 391266fef437c97397d82c0c1e4c4011b52b5019
4
+ data.tar.gz: 49b5b5f512db78213c595b1c891ad23b8969caa6
5
5
  SHA512:
6
- metadata.gz: c66299a2ffa4ef20a7402655cfe9ac40011f8d6b3414ae5918cc106dad4ec419140f1b3801aaf53ac5c6be76f040cd13958a1e90c3e34d1c05c3f3e9392d133d
7
- data.tar.gz: 59a0173c4cc78d1db2c1f551e8a3261a8bbee2e70d876f9c0d3a33ec4d785dc999c67414430eb62530cde501670e59b2c9bfe078f7a29ef7ac3179fa44fac5ce
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
@@ -1,4 +1,4 @@
1
1
  # This file specifies the current version of the gem.
2
2
  module DispatchRider
3
- VERSION = "1.2.10"
3
+ VERSION = "1.2.11"
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.10
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suman Mukherjee