ruote-amqp 0.9.21 → 0.9.21.1

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.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.9.21.1 2009-08-03
2
+
3
+ * Switch to using persistent AMQP messages by default
4
+
1
5
  === 0.9.21 2009-07-13
2
6
 
3
7
  * Depend on ruote-0.9.21 for flexible JSON backends
data/Manifest.txt CHANGED
@@ -16,6 +16,7 @@ script/destroy
16
16
  script/generate
17
17
  spec/listener_spec.rb
18
18
  spec/participant_spec.rb
19
+ spec/ruote_amqp_spec.rb
19
20
  spec/spec.opts
20
21
  spec/spec_helper.rb
21
22
  tasks/rspec.rake
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!" }
@@ -1,7 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe RuoteAMQP::Listener do
4
-
5
4
  it "should handle replies" do
6
5
  pdef = <<-EOF
7
6
  class AmqpParticipant2 < OpenWFE::ProcessDefinition
@@ -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
- # useful for tracking misuses of the application context
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-07-13 00:00:00 +02:00
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