jruby-jms 1.1.0-java → 1.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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +24 -7
  3. data/README.md +49 -49
  4. data/Rakefile +17 -12
  5. data/lib/jms.rb +8 -17
  6. data/lib/jms/bytes_message.rb +3 -19
  7. data/lib/jms/connection.rb +63 -83
  8. data/lib/jms/map_message.rb +9 -25
  9. data/lib/jms/message.rb +22 -173
  10. data/lib/jms/message_consumer.rb +23 -35
  11. data/lib/jms/message_listener_impl.rb +22 -38
  12. data/lib/jms/message_producer.rb +9 -25
  13. data/lib/jms/mq_workaround.rb +11 -26
  14. data/lib/jms/object_message.rb +1 -17
  15. data/lib/jms/oracle_a_q_connection_factory.rb +4 -21
  16. data/lib/jms/queue_browser.rb +2 -18
  17. data/lib/jms/session.rb +92 -106
  18. data/lib/jms/session_pool.rb +34 -41
  19. data/lib/jms/text_message.rb +0 -16
  20. data/lib/jms/version.rb +1 -1
  21. data/test/connection_test.rb +35 -81
  22. data/test/jms.yml +18 -8
  23. data/test/message_test.rb +27 -43
  24. data/test/session_pool_test.rb +30 -46
  25. data/test/session_test.rb +30 -45
  26. data/test/test_helper.rb +33 -0
  27. metadata +20 -26
  28. data/Gemfile +0 -8
  29. data/Gemfile.lock +0 -36
  30. data/examples/advanced/session_pool.rb +0 -37
  31. data/examples/client-server/replier.rb +0 -29
  32. data/examples/client-server/requestor.rb +0 -40
  33. data/examples/file-to-q/files_to_q.rb +0 -51
  34. data/examples/file-to-q/q_to_files.rb +0 -44
  35. data/examples/invm/invm.rb +0 -44
  36. data/examples/invm/log4j.properties +0 -58
  37. data/examples/jms.yml +0 -149
  38. data/examples/performance/consumer.rb +0 -25
  39. data/examples/performance/producer.rb +0 -31
  40. data/examples/producer-consumer/browser.rb +0 -24
  41. data/examples/producer-consumer/consumer.rb +0 -24
  42. data/examples/producer-consumer/consumer_async.rb +0 -41
  43. data/examples/producer-consumer/producer.rb +0 -25
  44. data/examples/publish-subscribe/publish.rb +0 -24
  45. data/examples/publish-subscribe/subscribe.rb +0 -31
  46. data/lib/jms/logging.rb +0 -50
  47. data/nbproject/private/private.properties +0 -3
  48. data/nbproject/private/rake-d.txt +0 -5
  49. data/parallel_minion.gemspec +0 -21
@@ -1,19 +1,3 @@
1
- ################################################################################
2
- # Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  # Extend JMS Message Producer Interface with Ruby methods
18
2
  #
19
3
  # For further help on javax.jms.MessageProducer
@@ -45,15 +29,15 @@ module JMS::MessageProducer
45
29
  # Example:
46
30
  # producer.delivery_mode_sym = :persistent
47
31
  def delivery_mode_sym=(mode)
48
- val = case mode
49
- when :persistent
50
- JMS::DeliveryMode::PERSISTENT
51
- when :non_persistent
52
- JMS::DeliveryMode::NON_PERSISTENT
53
- else
54
- raise "Unknown delivery mode symbol: #{mode}"
55
- end
56
- self.delivery_mode = val
32
+ self.delivery_mode =
33
+ case mode
34
+ when :persistent
35
+ JMS::DeliveryMode::PERSISTENT
36
+ when :non_persistent
37
+ JMS::DeliveryMode::NON_PERSISTENT
38
+ else
39
+ raise "Unknown delivery mode symbol: #{mode}"
40
+ end
57
41
  end
58
42
 
59
43
  end
@@ -1,68 +1,53 @@
1
1
  # Workaround for IBM MQ JMS implementation that implements some undocumented methods
2
-
3
2
  begin
4
-
5
3
  class com.ibm.mq.jms::MQQueueSession
6
-
7
- if self.instance_methods.include? "consume"
4
+ if self.method_defined?(:consume)
8
5
  def consume(params, &proc)
9
6
  Java::JavaxJms::Session.instance_method(:consume).bind(self).call(params, &proc)
10
7
  end
11
8
  end
12
-
13
9
  end
14
10
 
15
-
16
11
  class com.ibm.mq.jms::MQSession
17
-
18
- if self.instance_methods.include? "consume"
12
+ if self.method_defined?(:consume)
19
13
  def consume(params, &proc)
20
14
  Java::JavaxJms::Session.instance_method(:consume).bind(self).call(params, &proc)
21
15
  end
22
16
  end
23
-
24
- if self.instance_methods.include? "create_destination"
17
+
18
+ if self.method_defined?(:create_destination)
25
19
  def create_destination(params)
26
20
  Java::JavaxJms::Session.instance_method(:create_destination).bind(self).call(params)
27
21
  end
28
22
  end
29
-
30
23
  end
31
24
 
32
-
33
25
  class com.ibm.mq.jms::MQQueueBrowser
34
-
35
- if self.instance_methods.include? "each"
26
+ if self.method_defined?(:each)
36
27
  def each(params, &proc)
37
28
  Java::ComIbmMsgClientJms::JmsQueueBrowser.instance_method(:each).bind(self).call(params, &proc)
38
29
  end
39
30
  end
40
31
  end
41
-
42
32
 
43
33
  class com.ibm.mq.jms::MQQueueReceiver
44
-
45
- if self.instance_methods.include? "each"
34
+ if self.method_defined?(:each)
46
35
  def each(params, &proc)
47
36
  Java::JavaxJms::MessageConsumer.instance_method(:each).bind(self).call(params, &proc)
48
37
  end
49
38
  end
50
-
51
- if self.instance_methods.include? "get"
39
+
40
+ if self.method_defined?(:get)
52
41
  def get(params={})
53
42
  Java::JavaxJms::MessageConsumer.instance_method(:get).bind(self).call(params)
54
43
  end
55
44
  end
56
-
57
45
  end
58
-
59
-
46
+
60
47
  class com.ibm.mq.jms::MQQueue
61
-
62
- if self.instance_methods.include? "delete"
63
- undef_method :delete
48
+ if self.method_defined?(:delete)
49
+ undef_method :delete
64
50
  end
65
-
66
51
  end
67
52
 
68
53
  rescue NameError
@@ -1,20 +1,4 @@
1
- ################################################################################
2
- # Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
- #Interface javax.jms.ObjectMessage
1
+ # Interface javax.jms.ObjectMessage
18
2
  module JMS::ObjectMessage
19
3
  def data
20
4
  getObject
@@ -1,19 +1,3 @@
1
- ################################################################################
2
- # Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  module JMS
18
2
  # Full Qualified name causes a Java exception
19
3
  java_import 'oracle.jms.AQjmsFactory'
@@ -21,19 +5,18 @@ module JMS
21
5
  # Connection Factory to support Oracle AQ
22
6
  class OracleAQConnectionFactory
23
7
  attr_accessor :username, :url
24
- #attr_writer :password
25
- attr_accessor :password
8
+ attr_writer :password
26
9
 
27
10
  # Creates a connection per standard JMS 1.1 techniques from the Oracle AQ JMS Interface
28
11
  def create_connection(*args)
29
- # Since username and password are not assigned (see lib/jms/connection.rb:200)
30
- # and connection_factory.create_connection expects 2 arguments when username is not null ...
12
+ # Since username and password are not assigned (see lib/jms/connection.rb:200)
13
+ # and connection_factory.create_connection expects 2 arguments when username is not null ...
31
14
  if args.length == 2
32
15
  @username = args[0]
33
16
  @password = args[1]
34
17
  end
35
18
 
36
- # Full Qualified name causes a Java exception
19
+ # Full Qualified name causes a Java exception
37
20
  #cf = oracle.jms.AQjmsFactory.getConnectionFactory(@url, java.util.Properties.new)
38
21
  cf = AQjmsFactory.getConnectionFactory(@url, java.util.Properties.new)
39
22
 
@@ -1,24 +1,8 @@
1
- ################################################################################
2
- # Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
- #Interface javax.jms.QueueBrowser
1
+ # Interface javax.jms.QueueBrowser
18
2
  module JMS::QueueBrowser
19
3
  # For each message on the queue call the supplied Proc
20
4
  def each(params={}, &block)
21
- raise "JMS::QueueBrowser::each requires a code block to be executed for each message received" unless block
5
+ raise(ArgumentError, 'JMS::QueueBrowser::each requires a code block to be executed for each message received') unless block
22
6
 
23
7
  e = self.getEnumeration
24
8
  while e.hasMoreElements
data/lib/jms/session.rb CHANGED
@@ -1,19 +1,3 @@
1
- ################################################################################
2
- # Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  # For each thread that will be processing messages concurrently a separate
18
2
  # session is required. All sessions can share a single connection to the same
19
3
  # JMS Provider.
@@ -35,7 +19,7 @@
35
19
  # See: Connection::consumer
36
20
  #
37
21
  # Example:
38
- # destination = session.create_destination(:queue_name => "MyQueue")
22
+ # destination = session.create_destination(queue_name: "MyQueue")
39
23
  # session.create_consumer(destination)
40
24
  #
41
25
  # create_consumer(destination, message_selector)
@@ -118,25 +102,26 @@ module JMS::Session
118
102
  #
119
103
  # If automated duck typing is not desired, the type of the message can be specified
120
104
  # by setting the parameter 'type' to any one of:
121
- # :text => Creates a Text Message
122
- # :map => Creates a Map Message
123
- # :bytes => Creates a Bytes Message
105
+ # text: Creates a Text Message
106
+ # map: Creates a Map Message
107
+ # bytes: Creates a Bytes Message
124
108
  def message(data, type=nil)
125
109
  jms_message = nil
126
- type ||= if data.respond_to?(:to_str, false)
127
- :text
128
- elsif data.respond_to?(:each_pair, false)
129
- :map
130
- else
131
- raise "Unknown data type #{data.class.to_s} in Message"
132
- end
110
+ type ||=
111
+ if data.respond_to?(:to_str, false)
112
+ :text
113
+ elsif data.respond_to?(:each_pair, false)
114
+ :map
115
+ else
116
+ raise "Unknown data type #{data.class.to_s} in Message"
117
+ end
133
118
 
134
119
  case type
135
120
  when :text
136
- jms_message = self.createTextMessage
121
+ jms_message = self.createTextMessage
137
122
  jms_message.text = data.to_str
138
123
  when :map
139
- jms_message = self.createMapMessage
124
+ jms_message = self.createMapMessage
140
125
  jms_message.data = data
141
126
  when :bytes
142
127
  jms_message = self.createBytesMessage
@@ -160,19 +145,19 @@ module JMS::Session
160
145
  # of deleting them for you
161
146
  #
162
147
  # To create a queue:
163
- # session.create_destination(:queue_name => 'name of queue')
148
+ # session.create_destination(queue_name: 'name of queue')
164
149
  #
165
150
  # To create a temporary queue:
166
- # session.create_destination(:queue_name => :temporary)
151
+ # session.create_destination(queue_name: :temporary)
167
152
  #
168
153
  # To create a queue:
169
154
  # session.create_destination('queue://queue_name')
170
155
  #
171
156
  # To create a topic:
172
- # session.create_destination(:topic_name => 'name of queue')
157
+ # session.create_destination(topic_name: 'name of queue')
173
158
  #
174
159
  # To create a temporary topic:
175
- # session.create_destination(:topic_name => :temporary)
160
+ # session.create_destination(topic_name: :temporary)
176
161
  #
177
162
  # To create a topic:
178
163
  # session.create_destination('topic://topic_name')
@@ -180,16 +165,15 @@ module JMS::Session
180
165
  # Create the destination based on the parameter supplied
181
166
  #
182
167
  # Parameters:
183
- # :queue_name => String: Name of the Queue to return
184
- # Symbol: :temporary => Create temporary queue
168
+ # queue_name: [String] Name of the Queue to return
169
+ # [Symbol] Create temporary queue
185
170
  # Mandatory unless :topic_name is supplied
186
171
  # Or,
187
- # :topic_name => String: Name of the Topic to write to or subscribe to
188
- # Symbol: :temporary => Create temporary topic
172
+ # topic_name: [String] Name of the Topic to write to or subscribe to
173
+ # [Symbol] Create temporary topic
189
174
  # Mandatory unless :queue_name is supplied
190
175
  # Or,
191
- # :destination=> Explicit javaxJms::Destination to use
192
- #
176
+ # destination: [javaxJms::Destination] Destination to use
193
177
  # Returns the result of the supplied block
194
178
  def create_destination(params)
195
179
  # Allow a Java JMS destination object to be passed in
@@ -207,7 +191,9 @@ module JMS::Session
207
191
  topic_name = params[:topic_name]
208
192
  end
209
193
 
210
- raise "Missing mandatory parameter :queue_name or :topic_name to Session::producer, Session::consumer, or Session::browser" unless queue_name || topic_name
194
+ unless queue_name || topic_name
195
+ raise(ArgumentError, 'Missing mandatory parameter :queue_name or :topic_name to Session::producer, Session::consumer, or Session::browser')
196
+ end
211
197
 
212
198
  if queue_name
213
199
  queue_name == :temporary ? create_temporary_queue : create_queue(queue_name)
@@ -219,36 +205,36 @@ module JMS::Session
219
205
  # Create a queue or topic to send or receive messages from
220
206
  #
221
207
  # A block must be supplied so that if it is a temporary topic or queue
222
- # it will be deleted after the proc is complete
208
+ # it will be deleted after the block is complete
223
209
  #
224
210
  # To create a queue:
225
- # session.destination(:queue_name => 'name of queue')
211
+ # session.destination(queue_name: 'name of queue')
226
212
  #
227
213
  # To create a temporary queue:
228
- # session.destination(:queue_name => :temporary)
214
+ # session.destination(queue_name: :temporary)
229
215
  #
230
216
  # To create a topic:
231
- # session.destination(:topic_name => 'name of queue')
217
+ # session.destination(topic_name: 'name of queue')
232
218
  #
233
219
  # To create a temporary topic:
234
- # session.destination(:topic_name => :temporary)
220
+ # session.destination(topic_name: :temporary)
235
221
  #
236
222
  # Create the destination based on the parameter supplied
237
223
  #
238
224
  # Parameters:
239
- # :queue_name => String: Name of the Queue to return
240
- # Symbol: :temporary => Create temporary queue
225
+ # queue_name: [String] Name of the Queue to return
226
+ # [Symbol] Create temporary queue
241
227
  # Mandatory unless :topic_name is supplied
242
228
  # Or,
243
- # :topic_name => String: Name of the Topic to write to or subscribe to
244
- # Symbol: :temporary => Create temporary topic
229
+ # topic_name: [String] Name of the Topic to write to or subscribe to
230
+ # [Symbol] Create temporary topic
245
231
  # Mandatory unless :queue_name is supplied
246
232
  # Or,
247
- # :destination=> Explicit javaxJms::Destination to use
233
+ # destination: [javaxJms::Destination] Destination to use
248
234
  #
249
235
  # Returns the result of the supplied block
250
236
  def destination(params={}, &block)
251
- raise "Missing mandatory Block when calling JMS::Session#destination" unless block
237
+ raise(ArgumentError, 'Missing mandatory Block when calling JMS::Session#destination') unless block
252
238
  dest = nil
253
239
  begin
254
240
  dest = create_destination(params)
@@ -287,9 +273,9 @@ module JMS::Session
287
273
 
288
274
  # Return the topic matching the topic name supplied
289
275
  # Call the Proc if supplied
290
- def topic(topic_name, &proc)
276
+ def topic(topic_name, &block)
291
277
  t = create_topic(topic_name)
292
- proc.call(t) if proc
278
+ block.call(t) if block
293
279
  t
294
280
  end
295
281
 
@@ -317,20 +303,20 @@ module JMS::Session
317
303
  # Call the Proc if supplied, then automatically close the producer
318
304
  #
319
305
  # Parameters:
320
- # :queue_name => String: Name of the Queue to return
321
- # Symbol: :temporary => Create temporary queue
306
+ # queue_name: [String] Name of the Queue to return
307
+ # [Symbol] Create temporary queue
322
308
  # Mandatory unless :topic_name is supplied
323
309
  # Or,
324
- # :topic_name => String: Name of the Topic to write to or subscribe to
325
- # Symbol: :temporary => Create temporary topic
310
+ # topic_name: [String] Name of the Topic to write to or subscribe to
311
+ # [Symbol] Create temporary topic
326
312
  # Mandatory unless :queue_name is supplied
327
313
  # Or,
328
- # :destination=> Explicit JMS::Destination to use
329
- def producer(params, &proc)
314
+ # destination: [javaxJms::Destination] Destination to use
315
+ def producer(params, &block)
330
316
  p = self.create_producer(self.create_destination(params))
331
- if proc
317
+ if block
332
318
  begin
333
- proc.call(p)
319
+ block.call(p)
334
320
  ensure
335
321
  p.close
336
322
  p = nil
@@ -342,38 +328,38 @@ module JMS::Session
342
328
  # Return a consumer for the destination
343
329
  # A consumer can read messages from the queue or topic
344
330
  #
345
- # Call the Proc if supplied, then automatically close the consumer
331
+ # Call the block if supplied, then automatically close the consumer
346
332
  #
347
333
  # Parameters:
348
- # :queue_name => String: Name of the Queue to return
349
- # Symbol: :temporary => Create temporary queue
334
+ # queue_name: [String] Name of the Queue to return
335
+ # [Symbol] Create temporary queue
350
336
  # Mandatory unless :topic_name is supplied
351
337
  # Or,
352
- # :topic_name => String: Name of the Topic to write to or subscribe to
353
- # Symbol: :temporary => Create temporary topic
338
+ # topic_name: [String] Name of the Topic to write to or subscribe to
339
+ # [Symbol] Create temporary topic
354
340
  # Mandatory unless :queue_name is supplied
355
341
  # Or,
356
- # :destination=> Explicit javaxJms::Destination to use
342
+ # destination: [javaxJms::Destination] Destination to use
357
343
  #
358
- # :selector => Filter which messages should be returned from the queue
344
+ # selector: Filter which messages should be returned from the queue
359
345
  # Default: All messages
360
- # :no_local => Determine whether messages published by its own connection
346
+ # no_local: Determine whether messages published by its own connection
361
347
  # should be delivered to it
362
348
  # Default: false
363
- def consumer(params, &proc)
349
+ def consumer(params, &block)
364
350
  destination = create_destination(params)
365
- c = nil
366
- if params[:no_local]
367
- c = create_consumer(destination, params[:selector] || '', params[:no_local])
368
- elsif params[:selector]
369
- c = create_consumer(destination, params[:selector])
370
- else
371
- c = create_consumer(destination)
372
- end
351
+ c =
352
+ if params[:no_local]
353
+ create_consumer(destination, params[:selector] || '', params[:no_local])
354
+ elsif params[:selector]
355
+ create_consumer(destination, params[:selector])
356
+ else
357
+ create_consumer(destination)
358
+ end
373
359
 
374
- if proc
360
+ if block
375
361
  begin
376
- proc.call(c)
362
+ block.call(c)
377
363
  ensure
378
364
  c.close
379
365
  c = nil
@@ -386,19 +372,19 @@ module JMS::Session
386
372
  # A consumer can read messages from the queue or topic
387
373
  #
388
374
  # Parameters:
389
- # :queue_name => String: Name of the Queue to return
390
- # Symbol: :temporary => Create temporary queue
375
+ # queue_name: [String] Name of the Queue to return
376
+ # [Symbol] Create temporary queue
391
377
  # Mandatory unless :topic_name is supplied
392
378
  # Or,
393
- # :topic_name => String: Name of the Topic to write to or subscribe to
394
- # Symbol: :temporary => Create temporary topic
379
+ # topic_name: [String] Name of the Topic to write to or subscribe to
380
+ # [Symbol] Create temporary topic
395
381
  # Mandatory unless :queue_name is supplied
396
382
  # Or,
397
- # :destination=> Explicit javaxJms::Destination to use
383
+ # destination: [javaxJms::Destination] Destination to use
398
384
  #
399
- # :selector => Filter which messages should be returned from the queue
385
+ # selector: Filter which messages should be returned from the queue
400
386
  # Default: All messages
401
- # :no_local => Determine whether messages published by its own connection
387
+ # no_local: Determine whether messages published by its own connection
402
388
  # should be delivered to it
403
389
  # Default: false
404
390
  #
@@ -410,12 +396,12 @@ module JMS::Session
410
396
  # in the time interval specified
411
397
  # Default: 0
412
398
  #
413
- def consume(params, &proc)
414
- c = self.consumer(params)
399
+ def consume(params, &block)
415
400
  begin
416
- c.each(params, &proc)
401
+ c = self.consumer(params)
402
+ c.each(params, &block)
417
403
  ensure
418
- c.close
404
+ c.close if c
419
405
  end
420
406
  end
421
407
 
@@ -426,28 +412,28 @@ module JMS::Session
426
412
  # Call the Proc if supplied, then automatically close the consumer
427
413
  #
428
414
  # Parameters:
429
- # :queue_name => String: Name of the Queue to return
430
- # Symbol: :temporary => Create temporary queue
415
+ # queue_name: [String] Name of the Queue to return
416
+ # [Symbol] Create temporary queue
431
417
  # Mandatory unless :topic_name is supplied
432
418
  # Or,
433
- # :destination=> Explicit javaxJms::Destination to use
419
+ # destination: [javaxJms::Destination] Destination to use
434
420
  #
435
- # :selector => Filter which messages should be returned from the queue
421
+ # selector: Filter which messages should be returned from the queue
436
422
  # Default: All messages
437
- def browser(params, &proc)
438
- raise "Session::browser requires a code block to be executed" unless proc
423
+ def browser(params, &block)
424
+ raise(ArgumentError, 'Session::browser requires a code block to be executed') unless block
439
425
 
440
426
  destination = create_destination(params)
441
- b = nil
427
+ b = nil
442
428
  if params[:selector]
443
429
  b = create_browser(destination, params[:selector])
444
430
  else
445
431
  b = create_browser(destination)
446
432
  end
447
433
 
448
- if proc
434
+ if block
449
435
  begin
450
- proc.call(b)
436
+ block.call(b)
451
437
  ensure
452
438
  b.close
453
439
  b = nil
@@ -459,15 +445,15 @@ module JMS::Session
459
445
  # Browse the specified queue, calling the Proc supplied for each message found
460
446
  #
461
447
  # Parameters:
462
- # :queue_name => String: Name of the Queue to return
463
- # Symbol: :temporary => Create temporary queue
448
+ # queue_name: [String] Name of the Queue to return
449
+ # [Symbol] Create temporary queue
464
450
  # Mandatory unless :topic_name is supplied
465
451
  # Or,
466
- # :destination=> Explicit javaxJms::Destination to use
452
+ # destination: [javaxJms::Destination] Destination to use
467
453
  #
468
- # :selector => Filter which messages should be returned from the queue
454
+ # selector: Filter which messages should be returned from the queue
469
455
  # Default: All messages
470
- def browse(params={}, &proc)
471
- self.browser(params) {|b| b.each(params, &proc)}
456
+ def browse(params={}, &block)
457
+ self.browser(params) { |b| b.each(params, &block) }
472
458
  end
473
459
  end