torquebox-messaging 2.1.2-java → 2.2.0-java
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/lib/gem_hook.rb +1 -1
- data/lib/{hornetq-core-2.2.18.Final.jar → hornetq-core-2.2.21.Final.jar} +0 -0
- data/lib/{hornetq-jms-2.2.18.Final.jar → hornetq-jms-2.2.21.Final.jar} +0 -0
- data/lib/torquebox-messaging.jar +0 -0
- data/lib/torquebox-messaging.rb +4 -4
- data/lib/torquebox/messaging/backgroundable.rb +73 -20
- data/lib/torquebox/messaging/echo_processor.rb +3 -2
- data/lib/torquebox/messaging/{clojure_message.rb → edn_message.rb} +6 -6
- data/spec/backgroundable_spec.rb +220 -77
- metadata +176 -155
data/lib/gem_hook.rb
CHANGED
@@ -28,7 +28,7 @@ require 'torquebox/messaging/session'
|
|
28
28
|
|
29
29
|
require 'torquebox/messaging/message'
|
30
30
|
require 'torquebox/messaging/json_message'
|
31
|
-
require 'torquebox/messaging/
|
31
|
+
require 'torquebox/messaging/edn_message'
|
32
32
|
require 'torquebox/messaging/text_message'
|
33
33
|
require 'torquebox/messaging/marshal_base64_message'
|
34
34
|
require 'torquebox/messaging/marshal_message'
|
Binary file
|
Binary file
|
data/lib/torquebox-messaging.jar
CHANGED
Binary file
|
data/lib/torquebox-messaging.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module TorqueboxMessaging
|
2
|
-
VERSION = '2.
|
3
|
-
MAVEN_VERSION = '2.
|
2
|
+
VERSION = '2.2.0'
|
3
|
+
MAVEN_VERSION = '2.2.0'
|
4
4
|
end
|
5
5
|
begin
|
6
6
|
require 'java'
|
7
7
|
require File.dirname(__FILE__) + '/torquebox-messaging.jar'
|
8
8
|
require File.dirname(__FILE__) + '/jboss-jms-api_1.1_spec-1.0.1.Final.jar'
|
9
9
|
require File.dirname(__FILE__) + '/jboss-transaction-api_1.1_spec-1.0.1.Final.jar'
|
10
|
-
require File.dirname(__FILE__) + '/hornetq-core-2.2.
|
11
|
-
require File.dirname(__FILE__) + '/hornetq-jms-2.2.
|
10
|
+
require File.dirname(__FILE__) + '/hornetq-core-2.2.21.Final.jar'
|
11
|
+
require File.dirname(__FILE__) + '/hornetq-jms-2.2.21.Final.jar'
|
12
12
|
require File.dirname(__FILE__) + '/netty-3.2.6.Final.jar'
|
13
13
|
rescue LoadError
|
14
14
|
puts 'JAR-based gems require JRuby to load. Please visit www.jruby.org.'
|
@@ -20,6 +20,7 @@ require 'torquebox/messaging/future'
|
|
20
20
|
require 'torquebox/messaging/task'
|
21
21
|
require 'torquebox/messaging/future_status'
|
22
22
|
require 'torquebox/injectors'
|
23
|
+
require 'torquebox/logger'
|
23
24
|
|
24
25
|
module TorqueBox
|
25
26
|
module Messaging
|
@@ -64,22 +65,31 @@ module TorqueBox
|
|
64
65
|
if !@__backgroundable_methods[method]
|
65
66
|
@__backgroundable_methods[method] ||= { }
|
66
67
|
@__backgroundable_methods[method][:options] = options
|
67
|
-
if Util.
|
68
|
-
Util.
|
68
|
+
if Util.singleton_methods_include?(self, method) ||
|
69
|
+
Util.instance_methods_include?(self, method)
|
69
70
|
__enable_backgrounding(method)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
# Allows you to background any method that has not been marked
|
77
|
+
# as a backgrounded method via {ClassMethods#always_background}.
|
78
|
+
# @param [Hash] options that are passed through to
|
79
|
+
# {TorqueBox::Messaging::Destination#publish}
|
80
|
+
# @return [Future]
|
81
|
+
def background(options = { })
|
82
|
+
BackgroundProxy.new(self, options)
|
83
|
+
end
|
84
|
+
|
75
85
|
def method_added(method)
|
76
86
|
super
|
77
|
-
method
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
87
|
+
__method_added(method)
|
88
|
+
end
|
89
|
+
|
90
|
+
def singleton_method_added(method)
|
91
|
+
super
|
92
|
+
__method_added(method)
|
83
93
|
end
|
84
94
|
|
85
95
|
def __enable_backgroundable_newrelic_tracing(method)
|
@@ -102,28 +112,57 @@ module TorqueBox
|
|
102
112
|
end
|
103
113
|
|
104
114
|
private
|
115
|
+
|
116
|
+
def __method_added(method)
|
117
|
+
method = method.to_s
|
118
|
+
if @__backgroundable_methods &&
|
119
|
+
@__backgroundable_methods[method] &&
|
120
|
+
!@__backgroundable_methods[method][:backgrounding]
|
121
|
+
__enable_backgrounding(method)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
105
125
|
def __enable_backgrounding(method)
|
106
|
-
|
107
|
-
|
126
|
+
singleton_method = Util.singleton_methods_include?(self, method)
|
127
|
+
singleton = (class << self; self; end)
|
128
|
+
|
129
|
+
if singleton_method
|
130
|
+
|
131
|
+
TorqueBox::Logger.new( self ).
|
132
|
+
warn("always_background called for :#{method}, but :#{method} " +
|
133
|
+
"exists as both a class and instance method. Only the " +
|
134
|
+
"class method will be backgrounded.") if Util.instance_methods_include?(self, method)
|
135
|
+
|
136
|
+
privatize = Util.private_singleton_methods_include?(self, method)
|
137
|
+
protect = Util.protected_singleton_methods_include?(self, method) unless privatize
|
138
|
+
else
|
139
|
+
privatize = Util.private_instance_methods_include?(self, method)
|
140
|
+
protect = Util.protected_instance_methods_include?(self, method) unless privatize
|
141
|
+
end
|
142
|
+
|
108
143
|
async_method = "__async_#{method}"
|
109
144
|
sync_method = "__sync_#{method}"
|
110
145
|
|
111
146
|
@__backgroundable_methods[method][:backgrounding] = true
|
112
147
|
options = @__backgroundable_methods[method][:options]
|
113
|
-
class_eval do
|
114
148
|
|
149
|
+
(singleton_method ? singleton : self).class_eval do
|
115
150
|
define_method async_method do |*args|
|
116
151
|
Util.publish_message(self, sync_method, args, options)
|
117
152
|
end
|
118
|
-
|
119
|
-
alias_method sync_method, method
|
120
|
-
alias_method method, async_method
|
121
|
-
|
122
|
-
if privatize || protect
|
123
|
-
send((privatize ? :private : :protected), method, sync_method, async_method)
|
124
|
-
end
|
125
|
-
|
126
153
|
end
|
154
|
+
|
155
|
+
code = singleton_method ? "class << self" : ""
|
156
|
+
code << %Q{
|
157
|
+
alias_method :#{sync_method}, :#{method}
|
158
|
+
alias_method :#{method}, :#{async_method}
|
159
|
+
}
|
160
|
+
code << %Q{
|
161
|
+
#{privatize ? "private" : "protected"} :#{method}, :#{sync_method}, :#{async_method}
|
162
|
+
} if privatize || protect
|
163
|
+
code << "end" if singleton_method
|
164
|
+
|
165
|
+
class_eval code
|
127
166
|
ensure
|
128
167
|
@__backgroundable_methods[method][:backgrounding] = nil
|
129
168
|
end
|
@@ -163,8 +202,22 @@ module TorqueBox
|
|
163
202
|
raise RuntimeError.new("The Backgroundable queue is not available. Did you disable it by setting its concurrency to 0?")
|
164
203
|
end
|
165
204
|
|
205
|
+
def singleton_methods_include?(klass, method)
|
206
|
+
methods_include?(klass.singleton_methods, method) ||
|
207
|
+
private_singleton_methods_include?(klass, method)
|
208
|
+
end
|
209
|
+
|
210
|
+
def private_singleton_methods_include?(klass, method)
|
211
|
+
methods_include?(klass.private_methods, method)
|
212
|
+
end
|
213
|
+
|
214
|
+
def protected_singleton_methods_include?(klass, method)
|
215
|
+
methods_include?(klass.protected_methods, method)
|
216
|
+
end
|
217
|
+
|
166
218
|
def instance_methods_include?(klass, method)
|
167
|
-
methods_include?(klass.instance_methods, method)
|
219
|
+
methods_include?(klass.instance_methods, method) ||
|
220
|
+
private_instance_methods_include?(klass, method)
|
168
221
|
end
|
169
222
|
|
170
223
|
def private_instance_methods_include?(klass, method)
|
@@ -1,7 +1,8 @@
|
|
1
|
-
#
|
2
|
-
# another queue specified by the response_queue configuration option
|
1
|
+
# @api private
|
3
2
|
module Torquebox
|
4
3
|
module Messaging
|
4
|
+
# A message processor that echos any messages sent to it back to
|
5
|
+
# another queue specified by the response_queue configuration option
|
5
6
|
class EchoProcessor < TorqueBox::Messaging::MessageProcessor
|
6
7
|
|
7
8
|
def initialize(options={})
|
@@ -15,23 +15,23 @@
|
|
15
15
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
16
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
17
|
|
18
|
-
require '
|
18
|
+
require 'edn'
|
19
19
|
|
20
20
|
module TorqueBox
|
21
21
|
module Messaging
|
22
|
-
class
|
23
|
-
ENCODING = :
|
22
|
+
class EdnMessage < Message
|
23
|
+
ENCODING = :edn
|
24
24
|
JMS_TYPE = :text
|
25
25
|
|
26
26
|
def encode(message)
|
27
|
-
@jms_message.text =
|
27
|
+
@jms_message.text = message.to_edn
|
28
28
|
end
|
29
29
|
|
30
30
|
def decode
|
31
|
-
|
31
|
+
EDN.read(@jms_message.text) unless @jms_message.text.nil?
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
Message.register_encoding(
|
35
|
+
Message.register_encoding( EdnMessage )
|
36
36
|
end
|
37
37
|
end
|
data/spec/backgroundable_spec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'torquebox/messaging/backgroundable'
|
2
|
+
require 'pp'
|
2
3
|
|
3
|
-
class
|
4
|
+
class InstanceMethodTestModel
|
4
5
|
include TorqueBox::Messaging::Backgroundable
|
5
6
|
|
6
7
|
def an_async_action(arg1, arg2)
|
@@ -15,45 +16,137 @@ class MyTestModel
|
|
15
16
|
def redefine_me; end
|
16
17
|
end
|
17
18
|
|
19
|
+
class ClassMethodTestModel
|
20
|
+
include TorqueBox::Messaging::Backgroundable
|
21
|
+
|
22
|
+
def self.an_async_action(arg1, arg2)
|
23
|
+
a_sync_action
|
24
|
+
end
|
25
|
+
always_background :an_async_action
|
26
|
+
|
27
|
+
def self.a_sync_action; end
|
28
|
+
def self.foo; end
|
29
|
+
def self.bar; end
|
30
|
+
def self.optioned; end
|
31
|
+
def self.redefine_me; end
|
32
|
+
|
33
|
+
def foo; end
|
34
|
+
|
35
|
+
class << self
|
36
|
+
def singleton_class
|
37
|
+
self
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
18
42
|
describe TorqueBox::Messaging::Backgroundable do
|
19
43
|
before(:all) do
|
20
44
|
@util = TorqueBox::Messaging::Backgroundable::Util
|
21
45
|
end
|
22
46
|
|
23
47
|
describe "always_background" do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
48
|
+
context "for instance methods" do
|
49
|
+
it "should be able to handle multiple methods" do
|
50
|
+
InstanceMethodTestModel.always_background :foo, :bar
|
51
|
+
@util.instance_methods_include?(InstanceMethodTestModel, '__async_foo').should be_true
|
52
|
+
@util.instance_methods_include?(InstanceMethodTestModel, '__async_bar').should be_true
|
53
|
+
end
|
29
54
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
55
|
+
it "should handle methods that are defined after the always_background call" do
|
56
|
+
InstanceMethodTestModel.always_background :baz
|
57
|
+
@util.instance_methods_include?(InstanceMethodTestModel, '__async_baz').should_not be_true
|
58
|
+
InstanceMethodTestModel.class_eval('def baz;end')
|
59
|
+
@util.instance_methods_include?(InstanceMethodTestModel, '__async_baz').should be_true
|
60
|
+
end
|
36
61
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
62
|
+
it "should handle methods that are redefined after the always_background call" do
|
63
|
+
InstanceMethodTestModel.always_background :redefine_me
|
64
|
+
InstanceMethodTestModel.class_eval('def redefine_me; :xyz; end')
|
65
|
+
InstanceMethodTestModel.new.__sync_redefine_me.should == :xyz
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should work for private methods, maintaining visibility" do
|
69
|
+
InstanceMethodTestModel.class_eval('private; def no_peeking;end')
|
70
|
+
InstanceMethodTestModel.always_background :no_peeking
|
71
|
+
@util.private_instance_methods_include?(InstanceMethodTestModel, 'no_peeking').should be_true
|
72
|
+
@util.private_instance_methods_include?(InstanceMethodTestModel, '__async_no_peeking').should be_true
|
73
|
+
@util.private_instance_methods_include?(InstanceMethodTestModel, '__sync_no_peeking').should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should work for protected methods, maintaining visibility" do
|
77
|
+
InstanceMethodTestModel.class_eval('protected; def some_peeking;end')
|
78
|
+
InstanceMethodTestModel.always_background :some_peeking
|
79
|
+
@util.protected_instance_methods_include?(InstanceMethodTestModel, 'some_peeking').should be_true
|
80
|
+
@util.protected_instance_methods_include?(InstanceMethodTestModel, '__async_some_peeking').should be_true
|
81
|
+
@util.protected_instance_methods_include?(InstanceMethodTestModel, '__sync_some_peeking').should be_true
|
82
|
+
end
|
49
83
|
end
|
50
84
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
85
|
+
context "for class methods" do
|
86
|
+
it "should work when called after the method is defined" do
|
87
|
+
@util.singleton_methods_include?(ClassMethodTestModel, '__async_an_async_action').should be_true
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should be able to handle multiple methods" do
|
91
|
+
ClassMethodTestModel.always_background :foo, :bar
|
92
|
+
@util.singleton_methods_include?(ClassMethodTestModel, '__async_foo').should be_true
|
93
|
+
@util.singleton_methods_include?(ClassMethodTestModel, '__async_bar').should be_true
|
94
|
+
end
|
95
|
+
|
96
|
+
it "class methods should win a tie" do
|
97
|
+
ClassMethodTestModel.always_background :foo
|
98
|
+
@util.singleton_methods_include?(ClassMethodTestModel, '__async_foo').should be_true
|
99
|
+
@util.instance_methods_include?(ClassMethodTestModel, '__async_foo').should_not be_true
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should handle methods that are defined after the always_background call" do
|
103
|
+
ClassMethodTestModel.always_background :baz
|
104
|
+
@util.singleton_methods_include?(ClassMethodTestModel, '__async_baz').should_not be_true
|
105
|
+
ClassMethodTestModel.class_eval('def self.baz;end')
|
106
|
+
@util.singleton_methods_include?(ClassMethodTestModel, '__async_baz').should be_true
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should handle methods that are redefined after the always_background call" do
|
110
|
+
ClassMethodTestModel.always_background :redefine_me
|
111
|
+
ClassMethodTestModel.class_eval('def self.redefine_me; :xyz; end')
|
112
|
+
ClassMethodTestModel.__sync_redefine_me.should == :xyz
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should work for private methods, maintaining visibility" do
|
116
|
+
ClassMethodTestModel.class_eval do
|
117
|
+
class << self
|
118
|
+
private
|
119
|
+
def no_peeking;end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
ClassMethodTestModel.always_background :no_peeking
|
124
|
+
|
125
|
+
@util.private_singleton_methods_include?(ClassMethodTestModel,
|
126
|
+
'no_peeking').should be_true
|
127
|
+
@util.private_singleton_methods_include?(ClassMethodTestModel,
|
128
|
+
'__async_no_peeking').should be_true
|
129
|
+
@util.private_singleton_methods_include?(ClassMethodTestModel,
|
130
|
+
'__sync_no_peeking').should be_true
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should work for protected methods, maintaining visibility" do
|
134
|
+
ClassMethodTestModel.class_eval do
|
135
|
+
class << self
|
136
|
+
protected
|
137
|
+
def some_peeking;end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
ClassMethodTestModel.always_background :some_peeking
|
142
|
+
|
143
|
+
@util.protected_singleton_methods_include?(ClassMethodTestModel,
|
144
|
+
'some_peeking').should be_true
|
145
|
+
@util.protected_singleton_methods_include?(ClassMethodTestModel,
|
146
|
+
'__async_some_peeking').should be_true
|
147
|
+
@util.protected_singleton_methods_include?(ClassMethodTestModel,
|
148
|
+
'__sync_some_peeking').should be_true
|
149
|
+
end
|
57
150
|
end
|
58
151
|
|
59
152
|
end
|
@@ -68,16 +161,16 @@ describe TorqueBox::Messaging::Backgroundable do
|
|
68
161
|
|
69
162
|
it "should put a message on the queue" do
|
70
163
|
@queue.should_receive(:publish)
|
71
|
-
|
164
|
+
InstanceMethodTestModel.new.an_async_action(nil, nil)
|
72
165
|
end
|
73
166
|
|
74
167
|
it "should return a future" do
|
75
|
-
result =
|
168
|
+
result = InstanceMethodTestModel.new.an_async_action(nil, nil)
|
76
169
|
result.is_a?(TorqueBox::Messaging::Future).should be_true
|
77
170
|
end
|
78
|
-
|
171
|
+
|
79
172
|
it "should include the proper options in the message" do
|
80
|
-
object =
|
173
|
+
object = InstanceMethodTestModel.new
|
81
174
|
@queue.should_receive(:publish).with({
|
82
175
|
:receiver => object,
|
83
176
|
:future_id => '1234',
|
@@ -86,70 +179,120 @@ describe TorqueBox::Messaging::Backgroundable do
|
|
86
179
|
:args => [:a, :b]
|
87
180
|
},
|
88
181
|
anything)
|
89
|
-
object.an_async_action(:a, :b)
|
182
|
+
object.an_async_action(:a, :b)
|
90
183
|
end
|
91
|
-
|
184
|
+
|
92
185
|
it "should not call the action immediately" do
|
93
|
-
object =
|
186
|
+
object = InstanceMethodTestModel.new
|
94
187
|
object.should_not_receive(:a_sync_action)
|
95
188
|
object.an_async_action(nil, nil)
|
96
189
|
end
|
97
190
|
|
98
191
|
it "should pass through the options" do
|
99
|
-
|
192
|
+
InstanceMethodTestModel.always_background :optioned, :priority => :low
|
100
193
|
@queue.should_receive(:publish).with(anything, hash_including(:priority => :low))
|
101
|
-
|
194
|
+
InstanceMethodTestModel.new.optioned
|
102
195
|
end
|
103
196
|
|
104
197
|
end
|
105
198
|
|
106
199
|
describe 'background' do
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
200
|
+
context "for instance methods" do
|
201
|
+
before(:each) do
|
202
|
+
@queue = mock('queue')
|
203
|
+
@queue.stub(:publish)
|
204
|
+
TorqueBox::Messaging::Queue.stub(:new).and_return(@queue)
|
205
|
+
@object = InstanceMethodTestModel.new
|
206
|
+
end
|
113
207
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
208
|
+
it "should queue any method called on it" do
|
209
|
+
@queue.should_receive(:publish).with(hash_including(:method => :foo),
|
210
|
+
anything)
|
211
|
+
@object.background.foo
|
212
|
+
end
|
119
213
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
214
|
+
it "should queue the receiver" do
|
215
|
+
@queue.should_receive(:publish).with(hash_including(:receiver => @object), anything)
|
216
|
+
@object.background.foo
|
217
|
+
end
|
124
218
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
219
|
+
it "should queue the args" do
|
220
|
+
@queue.should_receive(:publish).with(hash_including(:args => [1,2]), anything)
|
221
|
+
@object.background.foo(1,2)
|
222
|
+
end
|
129
223
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
224
|
+
it "should raise when given a block" do
|
225
|
+
lambda {
|
226
|
+
@object.background.foo { }
|
227
|
+
}.should raise_error(ArgumentError)
|
228
|
+
end
|
135
229
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
230
|
+
it "should handle missing methods" do
|
231
|
+
@object.should_receive(:method_missing)
|
232
|
+
@object.background.no_method
|
233
|
+
end
|
140
234
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
235
|
+
it "should pass through any options" do
|
236
|
+
@queue.should_receive(:publish).with(anything,
|
237
|
+
hash_including(:ttl => 1))
|
238
|
+
@object.background(:ttl => 1).foo
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should always use the :marshal encoding" do
|
242
|
+
@queue.should_receive(:publish).with(anything,
|
243
|
+
hash_including(:encoding => :marshal))
|
244
|
+
@object.background.foo
|
245
|
+
end
|
146
246
|
|
147
|
-
it "should always use the :marshal encoding" do
|
148
|
-
@queue.should_receive(:publish).with(anything,
|
149
|
-
hash_including(:encoding => :marshal))
|
150
|
-
@object.background.foo
|
151
247
|
end
|
152
248
|
|
249
|
+
context "for class methods" do
|
250
|
+
before(:each) do
|
251
|
+
@queue = mock('queue')
|
252
|
+
@queue.stub(:publish)
|
253
|
+
TorqueBox::Messaging::Queue.stub(:new).and_return(@queue)
|
254
|
+
@object = ClassMethodTestModel
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should queue any method called on it" do
|
258
|
+
@queue.should_receive(:publish).with(hash_including(:method => :foo),
|
259
|
+
anything)
|
260
|
+
@object.background.foo
|
261
|
+
end
|
262
|
+
|
263
|
+
it "should queue the receiver" do
|
264
|
+
@queue.should_receive(:publish).with(hash_including(:receiver => @object), anything)
|
265
|
+
@object.background.foo
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should queue the args" do
|
269
|
+
@queue.should_receive(:publish).with(hash_including(:args => [1,2]), anything)
|
270
|
+
@object.background.foo(1,2)
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should raise when given a block" do
|
274
|
+
lambda {
|
275
|
+
@object.background.foo { }
|
276
|
+
}.should raise_error(ArgumentError)
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should handle missing methods" do
|
280
|
+
@object.should_receive(:method_missing)
|
281
|
+
@object.background.no_method
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should pass through any options" do
|
285
|
+
@queue.should_receive(:publish).with(anything,
|
286
|
+
hash_including(:ttl => 1))
|
287
|
+
@object.background(:ttl => 1).foo
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should always use the :marshal encoding" do
|
291
|
+
@queue.should_receive(:publish).with(anything,
|
292
|
+
hash_including(:encoding => :marshal))
|
293
|
+
@object.background.foo
|
294
|
+
end
|
295
|
+
end
|
153
296
|
end
|
154
|
-
|
297
|
+
|
155
298
|
end
|
metadata
CHANGED
@@ -1,170 +1,191 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquebox-messaging
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 2.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 2.2.0
|
6
6
|
platform: java
|
7
|
-
authors:
|
8
|
-
|
9
|
-
autorequire:
|
7
|
+
authors:
|
8
|
+
- The TorqueBox Team
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
12
|
+
date: 2012-12-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: torquebox-core
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 2.2.0
|
21
|
+
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.0
|
27
|
+
none: false
|
28
|
+
prerelease: false
|
29
|
+
type: :runtime
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: torquebox-transactions
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.2.0
|
37
|
+
none: false
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.2.0
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
45
|
+
type: :runtime
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: edn
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.0.0
|
53
|
+
none: false
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 1.0.0
|
59
|
+
none: false
|
60
|
+
prerelease: false
|
61
|
+
type: :runtime
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.7.0
|
69
|
+
none: false
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.7.0
|
75
|
+
none: false
|
76
|
+
prerelease: false
|
77
|
+
type: :development
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: newrelic_rpm
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 3.3.2
|
85
|
+
none: false
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 3.3.2
|
91
|
+
none: false
|
92
|
+
prerelease: false
|
93
|
+
type: :development
|
94
|
+
description: ''
|
95
|
+
email:
|
96
|
+
- torquebox-dev@torquebox.org
|
73
97
|
executables: []
|
74
|
-
|
75
98
|
extensions: []
|
76
|
-
|
77
99
|
extra_rdoc_files: []
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
- spec/datamapper_marshaling_spec.rb
|
100
|
+
files:
|
101
|
+
- licenses/lgpl-2.1.txt
|
102
|
+
- lib/torquebox-messaging.jar
|
103
|
+
- lib/torquebox-messaging.rb
|
104
|
+
- lib/jboss-jms-api_1.1_spec-1.0.1.Final.jar
|
105
|
+
- lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar
|
106
|
+
- lib/hornetq-core-2.2.21.Final.jar
|
107
|
+
- lib/hornetq-jms-2.2.21.Final.jar
|
108
|
+
- lib/netty-3.2.6.Final.jar
|
109
|
+
- lib/gem_hook.rb
|
110
|
+
- lib/org.torquebox.messaging-client.rb
|
111
|
+
- lib/torquebox/messaging.rb
|
112
|
+
- lib/torquebox/messaging/session.rb
|
113
|
+
- lib/torquebox/messaging/connection.rb
|
114
|
+
- lib/torquebox/messaging/datamapper_marshaling.rb
|
115
|
+
- lib/torquebox/messaging/backgroundable.rb
|
116
|
+
- lib/torquebox/messaging/marshal_message.rb
|
117
|
+
- lib/torquebox/messaging/echo_processor.rb
|
118
|
+
- lib/torquebox/messaging/xa_connection_factory.rb
|
119
|
+
- lib/torquebox/messaging/message_processor.rb
|
120
|
+
- lib/torquebox/messaging/json_message.rb
|
121
|
+
- lib/torquebox/messaging/xa_session.rb
|
122
|
+
- lib/torquebox/messaging/message.rb
|
123
|
+
- lib/torquebox/messaging/edn_message.rb
|
124
|
+
- lib/torquebox/messaging/task.rb
|
125
|
+
- lib/torquebox/messaging/connection_factory.rb
|
126
|
+
- lib/torquebox/messaging/marshal_base64_message.rb
|
127
|
+
- lib/torquebox/messaging/queue.rb
|
128
|
+
- lib/torquebox/messaging/xa_connection.rb
|
129
|
+
- lib/torquebox/messaging/backgroundable_processor.rb
|
130
|
+
- lib/torquebox/messaging/future.rb
|
131
|
+
- lib/torquebox/messaging/future_status.rb
|
132
|
+
- lib/torquebox/messaging/text_message.rb
|
133
|
+
- lib/torquebox/messaging/const_missing.rb
|
134
|
+
- lib/torquebox/messaging/destination.rb
|
135
|
+
- lib/torquebox/messaging/topic.rb
|
136
|
+
- lib/torquebox/messaging/future_responder.rb
|
137
|
+
- lib/torquebox/messaging/core.rb
|
138
|
+
- lib/torquebox/messaging/ext/javax_jms_queue_browser.rb
|
139
|
+
- lib/torquebox/messaging/processor_middleware/with_transaction.rb
|
140
|
+
- lib/torquebox/messaging/processor_middleware/chain.rb
|
141
|
+
- lib/torquebox/messaging/processor_middleware/default_middleware.rb
|
142
|
+
- spec/task_spec.rb
|
143
|
+
- spec/backgroundable_spec.rb
|
144
|
+
- spec/future_spec.rb
|
145
|
+
- spec/default_middleware_spec.rb
|
146
|
+
- spec/destination_spec.rb
|
147
|
+
- spec/message_spec.rb
|
148
|
+
- spec/message_processor_spec.rb
|
149
|
+
- spec/chain_spec.rb
|
150
|
+
- spec/json_message_spec.rb
|
151
|
+
- spec/future_responder_spec.rb
|
152
|
+
- spec/datamapper_marshaling_spec.rb
|
132
153
|
homepage: http://torquebox.org/
|
133
|
-
licenses:
|
134
|
-
|
135
|
-
post_install_message:
|
154
|
+
licenses:
|
155
|
+
- lgpl
|
156
|
+
post_install_message:
|
136
157
|
rdoc_options: []
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: !binary |-
|
165
|
+
MA==
|
141
166
|
none: false
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ! '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: !binary |-
|
172
|
+
MA==
|
147
173
|
none: false
|
148
|
-
requirements:
|
149
|
-
- - ">="
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: "0"
|
152
174
|
requirements: []
|
153
|
-
|
154
|
-
rubyforge_project:
|
175
|
+
rubyforge_project:
|
155
176
|
rubygems_version: 1.8.24
|
156
|
-
signing_key:
|
177
|
+
signing_key:
|
157
178
|
specification_version: 3
|
158
179
|
summary: TorqueBox Messaging Client
|
159
|
-
test_files:
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
180
|
+
test_files:
|
181
|
+
- spec/task_spec.rb
|
182
|
+
- spec/backgroundable_spec.rb
|
183
|
+
- spec/future_spec.rb
|
184
|
+
- spec/default_middleware_spec.rb
|
185
|
+
- spec/destination_spec.rb
|
186
|
+
- spec/message_spec.rb
|
187
|
+
- spec/message_processor_spec.rb
|
188
|
+
- spec/chain_spec.rb
|
189
|
+
- spec/json_message_spec.rb
|
190
|
+
- spec/future_responder_spec.rb
|
191
|
+
- spec/datamapper_marshaling_spec.rb
|