torquebox-messaging 3.2.0-java → 4.0.0.alpha1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/torquebox-messaging.rb +19 -20
  3. data/lib/torquebox/messaging.rb +80 -20
  4. data/lib/torquebox/messaging/context.rb +174 -0
  5. data/lib/torquebox/messaging/destination.rb +164 -215
  6. data/lib/torquebox/messaging/helpers.rb +34 -0
  7. data/lib/torquebox/messaging/hornetq.rb +70 -0
  8. data/lib/torquebox/messaging/hornetq/address_settings.rb +228 -0
  9. data/lib/torquebox/messaging/queue.rb +139 -301
  10. data/lib/torquebox/messaging/topic.rb +84 -46
  11. data/lib/wunderboss-jars/hornetq-commons-2.4.5.Final.jar +0 -0
  12. data/lib/wunderboss-jars/hornetq-core-client-2.4.5.Final.jar +0 -0
  13. data/lib/wunderboss-jars/hornetq-jms-client-2.4.5.Final.jar +0 -0
  14. data/lib/wunderboss-jars/hornetq-jms-server-2.4.5.Final.jar +0 -0
  15. data/lib/wunderboss-jars/hornetq-journal-2.4.5.Final.jar +0 -0
  16. data/lib/wunderboss-jars/hornetq-native-2.4.5.Final.jar +0 -0
  17. data/lib/wunderboss-jars/hornetq-server-2.4.5.Final.jar +0 -0
  18. data/lib/wunderboss-jars/javax.inject-1.jar +0 -0
  19. data/lib/wunderboss-jars/jboss-common-core-2.2.10.GA.jar +0 -0
  20. data/lib/wunderboss-jars/jboss-connector-api_1.5_spec-1.0.0.Final.jar +0 -0
  21. data/lib/wunderboss-jars/jboss-jms-api_2.0_spec-1.0.0.Final.jar +0 -0
  22. data/lib/wunderboss-jars/jboss-transaction-api_1.1_spec-1.0.0.Final.jar +0 -0
  23. data/lib/wunderboss-jars/jboss-transaction-spi-7.0.0.Final.jar +0 -0
  24. data/lib/wunderboss-jars/jnpserver-5.0.3.GA.jar +0 -0
  25. data/lib/wunderboss-jars/netty-all-4.0.13.Final.jar +0 -0
  26. data/lib/wunderboss-jars/wunderboss-messaging-1.x.incremental.174.jar +0 -0
  27. metadata +88 -98
  28. data/lib/gem_hook.rb +0 -51
  29. data/lib/hornetq-commons-2.3.1.Final.jar +0 -0
  30. data/lib/hornetq-core-client-2.3.1.Final.jar +0 -0
  31. data/lib/hornetq-jms-client-2.3.1.Final.jar +0 -0
  32. data/lib/hornetq-journal-2.3.1.Final.jar +0 -0
  33. data/lib/jboss-jms-api_1.1_spec-1.0.1.Final.jar +0 -0
  34. data/lib/jboss-logging-3.1.2.GA.jar +0 -0
  35. data/lib/jboss-logmanager-1.4.0.Final.jar +0 -0
  36. data/lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar +0 -0
  37. data/lib/netty-3.6.2.Final.jar +0 -0
  38. data/lib/org.torquebox.messaging-client.rb +0 -20
  39. data/lib/torquebox-messaging.jar +0 -0
  40. data/lib/torquebox/messaging/backgroundable.rb +0 -250
  41. data/lib/torquebox/messaging/backgroundable_processor.rb +0 -52
  42. data/lib/torquebox/messaging/connection.rb +0 -74
  43. data/lib/torquebox/messaging/connection_factory.rb +0 -115
  44. data/lib/torquebox/messaging/const_missing.rb +0 -28
  45. data/lib/torquebox/messaging/core.rb +0 -27
  46. data/lib/torquebox/messaging/datamapper_marshaling.rb +0 -43
  47. data/lib/torquebox/messaging/echo_processor.rb +0 -35
  48. data/lib/torquebox/messaging/edn_message.rb +0 -26
  49. data/lib/torquebox/messaging/ext/javax_jms_queue_browser.rb +0 -25
  50. data/lib/torquebox/messaging/future.rb +0 -131
  51. data/lib/torquebox/messaging/future_responder.rb +0 -109
  52. data/lib/torquebox/messaging/future_status.rb +0 -37
  53. data/lib/torquebox/messaging/json_message.rb +0 -26
  54. data/lib/torquebox/messaging/marshal_base64_message.rb +0 -26
  55. data/lib/torquebox/messaging/marshal_message.rb +0 -43
  56. data/lib/torquebox/messaging/message.rb +0 -137
  57. data/lib/torquebox/messaging/message_processor.rb +0 -209
  58. data/lib/torquebox/messaging/processor_middleware/chain.rb +0 -89
  59. data/lib/torquebox/messaging/processor_middleware/default_middleware.rb +0 -39
  60. data/lib/torquebox/messaging/processor_middleware/with_transaction.rb +0 -35
  61. data/lib/torquebox/messaging/session.rb +0 -173
  62. data/lib/torquebox/messaging/task.rb +0 -66
  63. data/lib/torquebox/messaging/text_message.rb +0 -36
  64. data/lib/torquebox/messaging/xa_connection.rb +0 -55
  65. data/lib/torquebox/messaging/xa_connection_factory.rb +0 -45
  66. data/lib/torquebox/messaging/xa_session.rb +0 -51
  67. data/licenses/cc0-1.0.txt +0 -121
  68. data/spec/backgroundable_spec.rb +0 -319
  69. data/spec/chain_spec.rb +0 -160
  70. data/spec/datamapper_marshaling_spec.rb +0 -25
  71. data/spec/default_middleware_spec.rb +0 -21
  72. data/spec/destination_spec.rb +0 -248
  73. data/spec/future_responder_spec.rb +0 -81
  74. data/spec/future_spec.rb +0 -163
  75. data/spec/message_processor_spec.rb +0 -211
  76. data/spec/message_spec.rb +0 -135
  77. data/spec/task_spec.rb +0 -111
@@ -1,51 +0,0 @@
1
- # Copyright 2008-2013 Red Hat, Inc, and individual contributors.
2
- #
3
- # This is free software; you can redistribute it and/or modify it
4
- # under the terms of the GNU Lesser General Public License as
5
- # published by the Free Software Foundation; either version 2.1 of
6
- # the License, or (at your option) any later version.
7
- #
8
- # This software is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this software; if not, write to the Free
15
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
17
-
18
- module TorqueBox
19
- module Messaging
20
-
21
- class XaSession < Session
22
- include javax.transaction.Synchronization
23
- attr_reader :transaction
24
-
25
- def initialize( jms_session, transaction, connection )
26
- super( jms_session )
27
- @transaction = transaction
28
- @connection = connection
29
- end
30
-
31
- def close
32
- # eat the close, until tx completes
33
- end
34
-
35
- def beforeCompletion
36
- # required interface
37
- end
38
-
39
- def afterCompletion(status)
40
- @connection.deactivate
41
- @connection.complete!
42
- end
43
-
44
- def xa_resource
45
- @jms_session.xa_resource
46
- end
47
-
48
- end
49
-
50
- end
51
- end
data/licenses/cc0-1.0.txt DELETED
@@ -1,121 +0,0 @@
1
- Creative Commons Legal Code
2
-
3
- CC0 1.0 Universal
4
-
5
- CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
- LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
- ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
- INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
- REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
- PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
- THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
- HEREUNDER.
13
-
14
- Statement of Purpose
15
-
16
- The laws of most jurisdictions throughout the world automatically confer
17
- exclusive Copyright and Related Rights (defined below) upon the creator
18
- and subsequent owner(s) (each and all, an "owner") of an original work of
19
- authorship and/or a database (each, a "Work").
20
-
21
- Certain owners wish to permanently relinquish those rights to a Work for
22
- the purpose of contributing to a commons of creative, cultural and
23
- scientific works ("Commons") that the public can reliably and without fear
24
- of later claims of infringement build upon, modify, incorporate in other
25
- works, reuse and redistribute as freely as possible in any form whatsoever
26
- and for any purposes, including without limitation commercial purposes.
27
- These owners may contribute to the Commons to promote the ideal of a free
28
- culture and the further production of creative, cultural and scientific
29
- works, or to gain reputation or greater distribution for their Work in
30
- part through the use and efforts of others.
31
-
32
- For these and/or other purposes and motivations, and without any
33
- expectation of additional consideration or compensation, the person
34
- associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
- is an owner of Copyright and Related Rights in the Work, voluntarily
36
- elects to apply CC0 to the Work and publicly distribute the Work under its
37
- terms, with knowledge of his or her Copyright and Related Rights in the
38
- Work and the meaning and intended legal effect of CC0 on those rights.
39
-
40
- 1. Copyright and Related Rights. A Work made available under CC0 may be
41
- protected by copyright and related or neighboring rights ("Copyright and
42
- Related Rights"). Copyright and Related Rights include, but are not
43
- limited to, the following:
44
-
45
- i. the right to reproduce, adapt, distribute, perform, display,
46
- communicate, and translate a Work;
47
- ii. moral rights retained by the original author(s) and/or performer(s);
48
- iii. publicity and privacy rights pertaining to a person's image or
49
- likeness depicted in a Work;
50
- iv. rights protecting against unfair competition in regards to a Work,
51
- subject to the limitations in paragraph 4(a), below;
52
- v. rights protecting the extraction, dissemination, use and reuse of data
53
- in a Work;
54
- vi. database rights (such as those arising under Directive 96/9/EC of the
55
- European Parliament and of the Council of 11 March 1996 on the legal
56
- protection of databases, and under any national implementation
57
- thereof, including any amended or successor version of such
58
- directive); and
59
- vii. other similar, equivalent or corresponding rights throughout the
60
- world based on applicable law or treaty, and any national
61
- implementations thereof.
62
-
63
- 2. Waiver. To the greatest extent permitted by, but not in contravention
64
- of, applicable law, Affirmer hereby overtly, fully, permanently,
65
- irrevocably and unconditionally waives, abandons, and surrenders all of
66
- Affirmer's Copyright and Related Rights and associated claims and causes
67
- of action, whether now known or unknown (including existing as well as
68
- future claims and causes of action), in the Work (i) in all territories
69
- worldwide, (ii) for the maximum duration provided by applicable law or
70
- treaty (including future time extensions), (iii) in any current or future
71
- medium and for any number of copies, and (iv) for any purpose whatsoever,
72
- including without limitation commercial, advertising or promotional
73
- purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
- member of the public at large and to the detriment of Affirmer's heirs and
75
- successors, fully intending that such Waiver shall not be subject to
76
- revocation, rescission, cancellation, termination, or any other legal or
77
- equitable action to disrupt the quiet enjoyment of the Work by the public
78
- as contemplated by Affirmer's express Statement of Purpose.
79
-
80
- 3. Public License Fallback. Should any part of the Waiver for any reason
81
- be judged legally invalid or ineffective under applicable law, then the
82
- Waiver shall be preserved to the maximum extent permitted taking into
83
- account Affirmer's express Statement of Purpose. In addition, to the
84
- extent the Waiver is so judged Affirmer hereby grants to each affected
85
- person a royalty-free, non transferable, non sublicensable, non exclusive,
86
- irrevocable and unconditional license to exercise Affirmer's Copyright and
87
- Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
- maximum duration provided by applicable law or treaty (including future
89
- time extensions), (iii) in any current or future medium and for any number
90
- of copies, and (iv) for any purpose whatsoever, including without
91
- limitation commercial, advertising or promotional purposes (the
92
- "License"). The License shall be deemed effective as of the date CC0 was
93
- applied by Affirmer to the Work. Should any part of the License for any
94
- reason be judged legally invalid or ineffective under applicable law, such
95
- partial invalidity or ineffectiveness shall not invalidate the remainder
96
- of the License, and in such case Affirmer hereby affirms that he or she
97
- will not (i) exercise any of his or her remaining Copyright and Related
98
- Rights in the Work or (ii) assert any associated claims and causes of
99
- action with respect to the Work, in either case contrary to Affirmer's
100
- express Statement of Purpose.
101
-
102
- 4. Limitations and Disclaimers.
103
-
104
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
- surrendered, licensed or otherwise affected by this document.
106
- b. Affirmer offers the Work as-is and makes no representations or
107
- warranties of any kind concerning the Work, express, implied,
108
- statutory or otherwise, including without limitation warranties of
109
- title, merchantability, fitness for a particular purpose, non
110
- infringement, or the absence of latent or other defects, accuracy, or
111
- the present or absence of errors, whether or not discoverable, all to
112
- the greatest extent permissible under applicable law.
113
- c. Affirmer disclaims responsibility for clearing rights of other persons
114
- that may apply to the Work or any use thereof, including without
115
- limitation any person's Copyright and Related Rights in the Work.
116
- Further, Affirmer disclaims responsibility for obtaining any necessary
117
- consents, permissions or other rights required for any use of the
118
- Work.
119
- d. Affirmer understands and acknowledges that Creative Commons is not a
120
- party to this document and has no duty or obligation with respect to
121
- this CC0 or use of the Work.
@@ -1,319 +0,0 @@
1
- require 'torquebox/messaging/backgroundable'
2
- require 'pp'
3
-
4
- class InstanceMethodTestModel
5
- include TorqueBox::Messaging::Backgroundable
6
-
7
- def an_async_action(arg1, arg2)
8
- a_sync_action
9
- end
10
- always_background :an_async_action
11
-
12
- def a_sync_action; end
13
- def foo; end
14
- def bar; end
15
- def optioned; end
16
- def redefine_me; end
17
- end
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
-
42
- describe TorqueBox::Messaging::Backgroundable do
43
- before(:all) do
44
- @util = TorqueBox::Messaging::Backgroundable::Util
45
- end
46
-
47
- describe "always_background" do
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
54
-
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
61
-
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
83
- end
84
-
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
150
- end
151
-
152
- end
153
-
154
- describe "a method handled asynchronously" do
155
- before(:each) do
156
- @queue = mock('queue')
157
- @queue.stub(:publish)
158
- TorqueBox::Messaging::Queue.stub(:new).and_return(@queue)
159
- TorqueBox::Messaging::Future.stub(:unique_id).and_return('1234')
160
- end
161
-
162
- it "should put a message on the queue" do
163
- @queue.should_receive(:publish)
164
- InstanceMethodTestModel.new.an_async_action(nil, nil)
165
- end
166
-
167
- it "should return a future" do
168
- result = InstanceMethodTestModel.new.an_async_action(nil, nil)
169
- result.is_a?(TorqueBox::Messaging::Future).should be_true
170
- end
171
-
172
- it "should include the proper options in the message" do
173
- object = InstanceMethodTestModel.new
174
- @queue.should_receive(:publish).with({
175
- :receiver => object,
176
- :future_id => '1234',
177
- :future_queue => "/queues/torquebox//tasks/torquebox_backgroundable",
178
- :method => '__sync_an_async_action',
179
- :future_ttl => nil,
180
- :args => [:a, :b]
181
- },
182
- anything)
183
- object.an_async_action(:a, :b)
184
- end
185
-
186
- it "should not call the action immediately" do
187
- object = InstanceMethodTestModel.new
188
- object.should_not_receive(:a_sync_action)
189
- object.an_async_action(nil, nil)
190
- end
191
-
192
- it "should pass through the options" do
193
- InstanceMethodTestModel.always_background :optioned, :priority => :low
194
- @queue.should_receive(:publish).with(anything, hash_including(:priority => :low))
195
- InstanceMethodTestModel.new.optioned
196
- end
197
-
198
- end
199
-
200
- describe 'background' do
201
- context "for instance methods" do
202
- before(:each) do
203
- @queue = mock('queue')
204
- @queue.stub(:publish)
205
- TorqueBox::Messaging::Queue.stub(:new).and_return(@queue)
206
- @object = InstanceMethodTestModel.new
207
- end
208
-
209
- it "should queue any method called on it" do
210
- @queue.should_receive(:publish).with(hash_including(:method => :foo),
211
- anything)
212
- @object.background.foo
213
- end
214
-
215
- it "should queue the receiver" do
216
- @queue.should_receive(:publish).with(hash_including(:receiver => @object), anything)
217
- @object.background.foo
218
- end
219
-
220
- it "should queue the args" do
221
- @queue.should_receive(:publish).with(hash_including(:args => [1,2]), anything)
222
- @object.background.foo(1,2)
223
- end
224
-
225
- it "should use default future ttl" do
226
- @queue.should_receive(:publish).with(hash_including(:future_ttl => nil), anything)
227
- @object.background.foo
228
- end
229
-
230
- it "should use custom future ttl" do
231
- @queue.should_receive(:publish).with(hash_including(:future_ttl => 100_000), anything)
232
- @object.background(:future_ttl => 100_000).foo
233
- end
234
-
235
- it "should raise when given a block" do
236
- lambda {
237
- @object.background.foo { }
238
- }.should raise_error(ArgumentError)
239
- end
240
-
241
- it "should handle missing methods" do
242
- @object.should_receive(:method_missing)
243
- @object.background.no_method
244
- end
245
-
246
- it "should pass through any options" do
247
- @queue.should_receive(:publish).with(anything,
248
- hash_including(:ttl => 1))
249
- @object.background(:ttl => 1).foo
250
- end
251
-
252
- it "should always use the :marshal encoding" do
253
- @queue.should_receive(:publish).with(anything,
254
- hash_including(:encoding => :marshal))
255
- @object.background.foo
256
- end
257
-
258
- end
259
-
260
- context "for class methods" do
261
- before(:each) do
262
- @queue = mock('queue')
263
- @queue.stub(:publish)
264
- TorqueBox::Messaging::Queue.stub(:new).and_return(@queue)
265
- @object = ClassMethodTestModel
266
- end
267
-
268
- it "should queue any method called on it" do
269
- @queue.should_receive(:publish).with(hash_including(:method => :foo),
270
- anything)
271
- @object.background.foo
272
- end
273
-
274
- it "should queue the receiver" do
275
- @queue.should_receive(:publish).with(hash_including(:receiver => @object), anything)
276
- @object.background.foo
277
- end
278
-
279
- it "should queue the args" do
280
- @queue.should_receive(:publish).with(hash_including(:args => [1,2]), anything)
281
- @object.background.foo(1,2)
282
- end
283
-
284
- it "should use default future ttl" do
285
- @queue.should_receive(:publish).with(hash_including(:future_ttl => nil), anything)
286
- @object.background.foo
287
- end
288
-
289
- it "should use custom future ttl" do
290
- @queue.should_receive(:publish).with(hash_including(:future_ttl => 100_000), anything)
291
- @object.background(:future_ttl => 100_000).foo
292
- end
293
-
294
- it "should raise when given a block" do
295
- lambda {
296
- @object.background.foo { }
297
- }.should raise_error(ArgumentError)
298
- end
299
-
300
- it "should handle missing methods" do
301
- @object.should_receive(:method_missing)
302
- @object.background.no_method
303
- end
304
-
305
- it "should pass through any options" do
306
- @queue.should_receive(:publish).with(anything,
307
- hash_including(:ttl => 1))
308
- @object.background(:ttl => 1).foo
309
- end
310
-
311
- it "should always use the :marshal encoding" do
312
- @queue.should_receive(:publish).with(anything,
313
- hash_including(:encoding => :marshal))
314
- @object.background.foo
315
- end
316
- end
317
- end
318
-
319
- end