iron_mq 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/iron_mq.gemspec +2 -2
- data/lib/iron_mq/messages.rb +6 -0
- data/test/Gemfile.lock +2 -2
- data/test/test_iron_mq.rb +45 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/iron_mq.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "iron_mq"
|
8
|
-
s.version = "1.7.
|
8
|
+
s.version = "1.7.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Travis Reeder"]
|
12
|
-
s.date = "2012-06-
|
12
|
+
s.date = "2012-06-08"
|
13
13
|
s.description = "Ruby client for IronMQ"
|
14
14
|
s.email = "travis@iron.io"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/iron_mq/messages.rb
CHANGED
@@ -62,6 +62,12 @@ module IronMQ
|
|
62
62
|
return ResponseBase.new(res)
|
63
63
|
end
|
64
64
|
|
65
|
+
def release(message_id, options={})
|
66
|
+
path2 = "#{self.path(options)}/#{message_id}/release"
|
67
|
+
res = @client.parse_response(@client.post(path2, options))
|
68
|
+
return ResponseBase.new(res)
|
69
|
+
end
|
70
|
+
|
65
71
|
end
|
66
72
|
|
67
73
|
class ResponseBase
|
data/test/Gemfile.lock
CHANGED
data/test/test_iron_mq.rb
CHANGED
@@ -182,5 +182,50 @@ class IronMQTests < TestBase
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
+
def test_release
|
186
|
+
puts 'test_release'
|
187
|
+
@client.queue_name = "test_release"
|
188
|
+
clear_queue
|
189
|
+
msgTxt = "testMessage-"+Time.now.to_s
|
190
|
+
puts msgTxt
|
191
|
+
msg_id = @client.messages.post(msgTxt, {:timeout => 3600}).id
|
192
|
+
puts "msg_id: #{msg_id}"
|
193
|
+
msg = @client.messages.get
|
194
|
+
p msg
|
195
|
+
assert msg.id == msg_id
|
196
|
+
# Ok, so should have received same message, now let's release it quicker than the original timeout
|
197
|
+
|
198
|
+
# but first, ensure the next get is nil
|
199
|
+
msg = @client.messages.get
|
200
|
+
p msg
|
201
|
+
assert msg.nil?
|
202
|
+
|
203
|
+
# now release it instantly
|
204
|
+
@client.messages.release(msg_id)
|
205
|
+
msg = @client.messages.get
|
206
|
+
p msg
|
207
|
+
assert msg
|
208
|
+
assert msg.id == msg_id
|
209
|
+
|
210
|
+
# ok, so should be reserved again
|
211
|
+
msgr = @client.messages.get
|
212
|
+
p msgr
|
213
|
+
assert msgr.nil?
|
214
|
+
|
215
|
+
# let's release it in 10 seconds
|
216
|
+
@client.messages.release(msg_id, :delay=>10)
|
217
|
+
msg = @client.messages.get
|
218
|
+
p msg
|
219
|
+
assert msg.nil?
|
220
|
+
|
221
|
+
sleep 11
|
222
|
+
|
223
|
+
msg = @client.messages.get
|
224
|
+
p msg
|
225
|
+
assert msg
|
226
|
+
|
227
|
+
|
228
|
+
end
|
229
|
+
|
185
230
|
end
|
186
231
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_mq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|