ruote-amqp 0.9.21 → 0.9.21.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +1 -0
- data/lib/ruote-amqp.rb +25 -1
- data/lib/ruote-amqp/participant.rb +4 -3
- data/spec/listener_spec.rb +0 -1
- data/spec/ruote_amqp_spec.rb +12 -0
- data/spec/spec_helper.rb +2 -2
- metadata +3 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/ruote-amqp.rb
CHANGED
@@ -17,9 +17,33 @@ end
|
|
17
17
|
require 'yaml'
|
18
18
|
require 'mq'
|
19
19
|
|
20
|
+
# AMQP participant and listener pair for ruote.
|
21
|
+
#
|
22
|
+
# == Documentation
|
23
|
+
#
|
24
|
+
# See #RuoteAMQP::Listener and #RuoteAMQP::Participant for detailed
|
25
|
+
# documentation on using each of them.
|
26
|
+
#
|
27
|
+
# == AMQP Notes
|
28
|
+
#
|
29
|
+
# RuoteAMQP uses durable queues and persistent messages by default, to ensure
|
30
|
+
# no messages get lost along the way and that running expressions doesn't have
|
31
|
+
# to be restarted in order for messages to be resent.
|
32
|
+
#
|
20
33
|
module RuoteAMQP
|
21
|
-
VERSION = '0.9.21'
|
34
|
+
VERSION = '0.9.21.1'
|
22
35
|
|
23
36
|
autoload 'Participant', 'ruote-amqp/participant'
|
24
37
|
autoload 'Listener', 'ruote-amqp/listener'
|
38
|
+
|
39
|
+
class << self
|
40
|
+
|
41
|
+
attr_writer :use_persistent_messages
|
42
|
+
|
43
|
+
# Whether or not to use persistent messages (true by default)
|
44
|
+
def use_persistent_messages?
|
45
|
+
@use_persistent_messages = true if @use_persistent_messages.nil?
|
46
|
+
@use_persistent_messages
|
47
|
+
end
|
48
|
+
end
|
25
49
|
end
|
@@ -107,7 +107,8 @@ module RuoteAMQP
|
|
107
107
|
# and fanout exchanges as well.
|
108
108
|
#
|
109
109
|
# The direct exchanges are always marked as durable by the
|
110
|
-
# participant
|
110
|
+
# participant, and messages are marked as persistent by default (see
|
111
|
+
# #RuoteAMQP)
|
111
112
|
#
|
112
113
|
class Participant
|
113
114
|
include OpenWFE::LocalParticipant
|
@@ -149,12 +150,12 @@ module RuoteAMQP
|
|
149
150
|
# Message or workitem?
|
150
151
|
if message = ( workitem.attributes['message'] || workitem.params['message'] )
|
151
152
|
ldebug { "sending message to queue: #{target_queue}" }
|
152
|
-
q.publish( message )
|
153
|
+
q.publish( message, :persistent => RuoteAMQP.use_persistent_messages? )
|
153
154
|
|
154
155
|
else
|
155
156
|
ldebug { "sending workitem to queue: #{target_queue}" }
|
156
157
|
|
157
|
-
q.publish( encode_workitem( workitem ) )
|
158
|
+
q.publish( encode_workitem( workitem ), :persistent => RuoteAMQP.use_persistent_messages? )
|
158
159
|
end
|
159
160
|
else
|
160
161
|
lerror { "no queue in workitem params!" }
|
data/spec/listener_spec.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe RuoteAMQP do
|
4
|
+
it "should use persistent messages by default" do
|
5
|
+
RuoteAMQP.use_persistent_messages?.should be_true
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should allow switching to transient messages" do
|
9
|
+
RuoteAMQP.use_persistent_messages = false
|
10
|
+
RuoteAMQP.use_persistent_messages?.should be_false
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -33,8 +33,8 @@ Spec::Runner.configure do |config|
|
|
33
33
|
old_put(k, v)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
|
-
|
36
|
+
#
|
37
|
+
# useful for tracking misuses of the application context
|
38
38
|
|
39
39
|
ac['__tracer'] = @tracer
|
40
40
|
ac[:ruby_eval_allowed] = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruote-amqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.21
|
4
|
+
version: 0.9.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Kalmer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-03 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- script/generate
|
79
79
|
- spec/listener_spec.rb
|
80
80
|
- spec/participant_spec.rb
|
81
|
+
- spec/ruote_amqp_spec.rb
|
81
82
|
- spec/spec.opts
|
82
83
|
- spec/spec_helper.rb
|
83
84
|
- tasks/rspec.rake
|