isimud 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e44d23a18cf13265519e1f9141b7548ef1a3974
4
- data.tar.gz: 11817dccd7145d8b56596836cbb214d2801cf549
3
+ metadata.gz: d00087ddb9c814123247016a8369c981460dd5fe
4
+ data.tar.gz: 08af358a3d6b7095c7612ac524ac3d02f82b42d0
5
5
  SHA512:
6
- metadata.gz: 718764a123733b2e68180f965a33aa49e5d9d5e6ac7debb7c7914b3ef406ba75aa62a9acf3c7bb54840249992a291add6c2252b755b7e2f82c8d33d26ef69a22
7
- data.tar.gz: c78ec602bf966b51015cb611d647ff793afa2a2ff162e11dcd0fcb4f660b6c3f63dc127f724c8948dc346f6052dac7ad6a7543feba07c7ffa349b8335b4762d3
6
+ metadata.gz: b13ddd2631d2f5354489b69aa1ad1e2dfffe2a1ab680f0c5ddffc37bdbe2cc05a9a32aeb40fbc8dc3c3e7e3fdbeec764e5920bc4b9d8e2a075467e4716f41bf0
7
+ data.tar.gz: 242fb5bca098a9f563d3a87b6b0dc26cebc868d86486af7d479ba23bac9cf06d87b2062363df5a4683aaa1ece0e288edba1f4a058234a2f889c57e13f21a90d7
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isimud (1.4.0)
4
+ isimud (1.4.2)
5
5
  activerecord (>= 4.1.4)
6
6
  activesupport (>= 4.1.4)
7
7
  bunny (>= 1.6.0)
data/README.md CHANGED
@@ -120,6 +120,14 @@ the message is not re-queued.
120
120
 
121
121
  # Changes
122
122
 
123
+ ## 1.4.2
124
+
125
+ * BunnyClient#publish now accepts additional metadata options
126
+ * Isimud::Event changes:
127
+ * Added #timestamp property
128
+ * Added #message_id for generating unique message IDs
129
+ * message_id is now added to metadata when publishing
130
+
123
131
  ## 1.4.1
124
132
 
125
133
  * Enable conditional re-queuing of messages after an exception is raised (see *Exception Handling* above).
@@ -0,0 +1 @@
1
+ a9ffe9f7f70785d88670b9115e349c2f7aedf57278d4a4d5ec6e741e82deef6ec64c75be283d9fe05f9f39d6ee5392ff6376a6a311848687df293191ab8b0e14
data/doc/_index.html CHANGED
@@ -91,7 +91,7 @@
91
91
  </div>
92
92
 
93
93
  <div id="footer">
94
- Generated on Wed Aug 24 18:59:44 2016 by
94
+ Generated on Wed Aug 24 20:16:22 2016 by
95
95
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
96
96
  0.8.7.6 (ruby-2.3.0).
97
97
  </div>
@@ -64,7 +64,7 @@
64
64
  <div id="content"><div id='filecontents'>Copyright (c) 2016 Welltok Inc.<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in all<br/>copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>SOFTWARE.</div></div>
65
65
 
66
66
  <div id="footer">
67
- Generated on Wed Aug 24 18:59:45 2016 by
67
+ Generated on Wed Aug 24 20:16:23 2016 by
68
68
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
69
69
  0.8.7.6 (ruby-2.3.0).
70
70
  </div>
data/doc/file.README.html CHANGED
@@ -217,7 +217,7 @@ falsey, the message is not re-queued.</p>
217
217
 
218
218
  <h1 id="label-Changes">Changes</h1>
219
219
 
220
- <h2 id="label-1.4.0">1.4.0</h2>
220
+ <h2 id="label-1.4.2">1.4.2</h2>
221
221
  <ul><li>
222
222
  <p>Enable conditional re-queuing of messages after an exception is raised (see
223
223
  <em>Exception Handling</em> above).</p>
@@ -225,6 +225,8 @@ falsey, the message is not re-queued.</p>
225
225
  <p>Log messages for receipt and ack of messages downgraded to debug level.</p>
226
226
  </li><li>
227
227
  <p>Force manual_ack mode for all queue subscriptions.</p>
228
+ </li><li>
229
+ <p>BunnyClient#publish now accepts additional</p>
228
230
  </li></ul>
229
231
 
230
232
  <h2 id="label-1.3.8">1.3.8</h2>
@@ -552,7 +554,7 @@ feature&#39;</code>)</p>
552
554
  </div></div>
553
555
 
554
556
  <div id="footer">
555
- Generated on Wed Aug 24 18:59:45 2016 by
557
+ Generated on Wed Aug 24 20:16:23 2016 by
556
558
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
557
559
  0.8.7.6 (ruby-2.3.0).
558
560
  </div>
data/doc/index.html CHANGED
@@ -217,7 +217,7 @@ falsey, the message is not re-queued.</p>
217
217
 
218
218
  <h1 id="label-Changes">Changes</h1>
219
219
 
220
- <h2 id="label-1.4.0">1.4.0</h2>
220
+ <h2 id="label-1.4.2">1.4.2</h2>
221
221
  <ul><li>
222
222
  <p>Enable conditional re-queuing of messages after an exception is raised (see
223
223
  <em>Exception Handling</em> above).</p>
@@ -225,6 +225,8 @@ falsey, the message is not re-queued.</p>
225
225
  <p>Log messages for receipt and ack of messages downgraded to debug level.</p>
226
226
  </li><li>
227
227
  <p>Force manual_ack mode for all queue subscriptions.</p>
228
+ </li><li>
229
+ <p>BunnyClient#publish now accepts additional</p>
228
230
  </li></ul>
229
231
 
230
232
  <h2 id="label-1.3.8">1.3.8</h2>
@@ -552,7 +554,7 @@ feature&#39;</code>)</p>
552
554
  </div></div>
553
555
 
554
556
  <div id="footer">
555
- Generated on Wed Aug 24 18:59:44 2016 by
557
+ Generated on Wed Aug 24 20:16:23 2016 by
556
558
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
557
559
  0.8.7.6 (ruby-2.3.0).
558
560
  </div>
@@ -93,7 +93,7 @@
93
93
  </div>
94
94
 
95
95
  <div id="footer">
96
- Generated on Wed Aug 24 18:59:45 2016 by
96
+ Generated on Wed Aug 24 20:16:23 2016 by
97
97
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
98
98
  0.8.7.6 (ruby-2.3.0).
99
99
  </div>
@@ -141,10 +141,13 @@ module Isimud
141
141
  # @param [String] exchange AMQP exchange name
142
142
  # @param [String] routing_key message routing key. This should always be in the form of words separated by dots
143
143
  # e.g. "user.goal.complete"
144
+ # @param [String] payload message payload
145
+ # @param [Hash] options additional message options
146
+ # @see Bunny::Exchange#publish
144
147
  # @see http://rubybunny.info/articles/exchanges.html
145
- def publish(exchange, routing_key, payload)
148
+ def publish(exchange, routing_key, payload, options = {})
146
149
  log "Isimud::BunnyClient#publish: exchange=#{exchange} routing_key=#{routing_key}", :debug
147
- channel.topic(exchange, durable: true).publish(payload, routing_key: routing_key, persistent: true)
150
+ channel.topic(exchange, durable: true).publish(payload, options.merge(routing_key: routing_key, persistent: true))
148
151
  end
149
152
 
150
153
  # Close and reopen the AMQP connection
data/lib/isimud/client.rb CHANGED
@@ -52,7 +52,7 @@ module Isimud
52
52
  Isimud.retry_failures.nil? ? status : Isimud.retry_failures
53
53
  end
54
54
 
55
- def publish(exchange, routing_key, payload)
55
+ def publish(exchange, routing_key, payload, options)
56
56
  end
57
57
 
58
58
  def reconnect
data/lib/isimud/event.rb CHANGED
@@ -9,6 +9,7 @@ module Isimud
9
9
  class Event
10
10
  include Isimud::Logging
11
11
  attr_accessor :type, :action, :user_id, :occurred_at, :eventful_type, :eventful_id, :attributes, :parameters
12
+ attr_reader :timestamp
12
13
  attr_writer :exchange
13
14
 
14
15
  DEFAULT_TYPE = :model
@@ -43,6 +44,7 @@ module Isimud
43
44
  else
44
45
  Time.now.utc
45
46
  end
47
+ @timestamp = Time.now
46
48
 
47
49
  eventful_object = options.delete(:eventful)
48
50
 
@@ -73,6 +75,12 @@ module Isimud
73
75
  [type.to_s, eventful_type, eventful_id, action].compact.join('.')
74
76
  end
75
77
 
78
+ # Message ID, which is generated from the exchange, routing_key, user_id, and timestamp. This is practically
79
+ # guaranteed to be unique across all publishers.
80
+ def message_id
81
+ [exchange, routing_key, user_id, timestamp.to_i, timestamp.nsec].join(':')
82
+ end
83
+
76
84
  # Return hash of data to be serialized to JSON
77
85
  # @option options [Boolean] :omit_parameters when set, do not include attributes or parameters in data
78
86
  # @return [Hash] data to serialize
@@ -112,7 +120,7 @@ module Isimud
112
120
  def publish
113
121
  data = self.serialize
114
122
  log "Event#publish: #{self.inspect}"
115
- Isimud.client.publish(exchange, routing_key, data)
123
+ Isimud.client.publish(exchange, routing_key, data, message_id: message_id)
116
124
  end
117
125
  end
118
126
  end
@@ -108,7 +108,7 @@ module Isimud
108
108
  queue
109
109
  end
110
110
 
111
- def publish(exchange, routing_key, payload)
111
+ def publish(exchange, routing_key, payload, _options = {})
112
112
  log "Isimud::TestClient: Delivering message exchange: #{exchange} key: #{routing_key} payload: #{payload}"
113
113
  call_queues = queues.values.select { |queue| queue.has_matching_key?(exchange, routing_key) }
114
114
  call_queues.each do |queue|
@@ -1,3 +1,3 @@
1
1
  module Isimud
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
data/release CHANGED
@@ -27,4 +27,4 @@ puts 'Publishing to RubyGems'.cyan
27
27
  run! "gem push #{built_gem_path}"
28
28
 
29
29
  puts 'Testing install'.cyan
30
- run! "gem install #{gem_version} -P MediumSecurity"
30
+ run! "gem install #{gem_name} -v #{Isimud::VERSION} -P MediumSecurity"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isimud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Feil
@@ -115,6 +115,7 @@ files:
115
115
  - certs/gfeil.pem
116
116
  - checksum/isimud-1.3.8.gem.sha512
117
117
  - checksum/isimud-1.4.0.gem.sha512
118
+ - checksum/isimud-1.4.1.gem.sha512
118
119
  - config.ru
119
120
  - config/tddium.yml
120
121
  - doc/Isimud.html
metadata.gz.sig CHANGED
Binary file