jruby-jms 0.10.2 → 0.11.0

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 (70) hide show
  1. data/HISTORY.md +15 -0
  2. data/README.md +27 -28
  3. data/Rakefile +7 -1
  4. data/doc/classes/JMS.html +265 -0
  5. data/doc/classes/JMS/BytesMessage.html +215 -0
  6. data/doc/classes/JMS/Connection.html +1145 -0
  7. data/doc/classes/JMS/MapMessage.html +333 -0
  8. data/doc/classes/JMS/Message.html +1085 -0
  9. data/doc/classes/JMS/MessageConsumer.html +316 -0
  10. data/doc/classes/JMS/MessageListenerImpl.html +262 -0
  11. data/doc/classes/JMS/ObjectMessage.html +170 -0
  12. data/doc/classes/JMS/OracleAQConnectionFactory.html +184 -0
  13. data/doc/classes/JMS/QueueBrowser.html +155 -0
  14. data/doc/classes/JMS/Session.html +947 -0
  15. data/doc/classes/JMS/SessionPool.html +411 -0
  16. data/doc/classes/JMS/TextMessage.html +194 -0
  17. data/doc/created.rid +1 -0
  18. data/doc/files/README_md.html +440 -0
  19. data/doc/files/lib/jms/bytes_message_rb.html +122 -0
  20. data/doc/files/lib/jms/connection_rb.html +140 -0
  21. data/doc/files/lib/jms/imports_rb.html +108 -0
  22. data/doc/files/lib/jms/logging_rb.html +129 -0
  23. data/doc/files/lib/jms/map_message_rb.html +122 -0
  24. data/doc/files/lib/jms/message_consumer_rb.html +122 -0
  25. data/doc/files/lib/jms/message_listener_impl_rb.html +122 -0
  26. data/doc/files/lib/jms/message_rb.html +122 -0
  27. data/doc/files/lib/jms/object_message_rb.html +122 -0
  28. data/doc/files/lib/jms/oracle_a_q_connection_factory_rb.html +122 -0
  29. data/doc/files/lib/jms/queue_browser_rb.html +122 -0
  30. data/doc/files/lib/jms/session_pool_rb.html +108 -0
  31. data/doc/files/lib/jms/session_rb.html +164 -0
  32. data/doc/files/lib/jms/text_message_rb.html +122 -0
  33. data/doc/files/lib/jms_rb.html +131 -0
  34. data/doc/fr_class_index.html +39 -0
  35. data/doc/fr_file_index.html +42 -0
  36. data/doc/fr_method_index.html +120 -0
  37. data/doc/index.html +24 -0
  38. data/doc/rdoc-style.css +208 -0
  39. data/examples/advanced/session_pool.rb +37 -0
  40. data/examples/client-server/replier.rb +29 -0
  41. data/examples/client-server/requestor.rb +40 -0
  42. data/examples/jms.yml +85 -9
  43. data/examples/performance/consumer.rb +6 -8
  44. data/examples/performance/producer.rb +10 -10
  45. data/examples/producer-consumer/browser.rb +24 -0
  46. data/examples/{consumer.rb → producer-consumer/consumer.rb} +5 -4
  47. data/examples/producer-consumer/consumer_async.rb +30 -0
  48. data/examples/{producer.rb → producer-consumer/producer.rb} +5 -3
  49. data/examples/publish-subscribe/publish.rb +24 -0
  50. data/examples/publish-subscribe/subscribe.rb +31 -0
  51. data/lib/jms/bytes_message.rb +52 -0
  52. data/lib/jms/connection.rb +170 -162
  53. data/lib/jms/imports.rb +21 -0
  54. data/lib/jms/logging.rb +17 -1
  55. data/lib/jms/{javax_jms_map_message.rb → map_message.rb} +2 -2
  56. data/lib/jms/message.rb +285 -0
  57. data/lib/jms/{javax_jms_message_consumer.rb → message_consumer.rb} +6 -3
  58. data/lib/jms/{message_listener.rb → message_listener_impl.rb} +3 -3
  59. data/lib/jms/{javax_jms_object_message.rb → object_message.rb} +1 -1
  60. data/lib/jms/oracle_a_q_connection_factory.rb +35 -0
  61. data/lib/jms/{javax_jms_queue_browser.rb → queue_browser.rb} +5 -4
  62. data/lib/jms/{javax_jms_session.rb → session.rb} +23 -25
  63. data/lib/jms/session_pool.rb +148 -0
  64. data/lib/jms/{javax_jms_text_message.rb → text_message.rb} +1 -1
  65. data/test/connection_test.rb +31 -29
  66. data/test/jms.yml +8 -9
  67. data/test/message_test.rb +29 -29
  68. data/test/session_test.rb +39 -39
  69. metadata +62 -22
  70. data/lib/jms/javax_jms_message.rb +0 -264
@@ -0,0 +1,947 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: JMS::Session</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">JMS::Session</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/jms/session_rb.html">
59
+ lib/jms/session.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ For each thread that will be processing messages concurrently a separate
78
+ session is required. All sessions can share a single connection to the same
79
+ <a href="../JMS.html">JMS</a> Provider.
80
+ </p>
81
+ <p>
82
+ Interface javax.jms.<a href="Session.html">Session</a>
83
+ </p>
84
+ <p>
85
+ See: <a
86
+ href="http://download.oracle.com/javaee/6/api/javax/jms/Session.html">download.oracle.com/javaee/6/api/javax/jms/Session.html</a>
87
+ </p>
88
+ <p>
89
+ Other methods still directly accessible through this class:
90
+ </p>
91
+ <p>
92
+ create_browser(<a href="Session.html#M000055">queue</a>, message_selector)
93
+ </p>
94
+ <pre>
95
+ Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector.
96
+ </pre>
97
+ <p>
98
+ create_bytes_message()
99
+ </p>
100
+ <pre>
101
+ Creates a BytesMessage object
102
+ </pre>
103
+ <p>
104
+ create_consumer(<a href="Session.html#M000054">destination</a>)
105
+ </p>
106
+ <pre>
107
+ Creates a MessageConsumer for the specified destination
108
+ See: Connection::consumer
109
+
110
+ Example:
111
+ destination = session.create_destination(:queue_name =&gt; &quot;MyQueue&quot;)
112
+ session.create_consumer(destination)
113
+
114
+ create_consumer(destination, message_selector)
115
+ Creates a MessageConsumer for the specified destination, using a message selector
116
+
117
+ create_consumer(destination, message_selector, boolean NoLocal)
118
+ Creates MessageConsumer for the specified destination, using a message selector
119
+ </pre>
120
+ <p>
121
+ create_durable_subscriber(Topic <a href="Session.html#M000057">topic</a>,
122
+ java.lang.String name)
123
+ </p>
124
+ <pre>
125
+ Creates a durable subscriber to the specified topic
126
+ </pre>
127
+ <p>
128
+ create_durable_subscriber(Topic <a href="Session.html#M000057">topic</a>,
129
+ java.lang.String name, java.lang.String messageSelector, boolean noLocal)
130
+ </p>
131
+ <pre>
132
+ Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.
133
+
134
+ create_map_Message()
135
+ Creates a MapMessage object
136
+
137
+ create_message()
138
+ Creates a Message object
139
+ </pre>
140
+ <p>
141
+ create_object_message()
142
+ </p>
143
+ <pre>
144
+ Creates an ObjectMessage object
145
+ </pre>
146
+ <p>
147
+ create_object_message(java.io.Serializable object)
148
+ </p>
149
+ <pre>
150
+ Creates an initialized ObjectMessage object
151
+
152
+ create_producer(destination)
153
+ Creates a MessageProducer to send messages to the specified destination
154
+ </pre>
155
+ <p>
156
+ create_queue(queue_name)
157
+ </p>
158
+ <pre>
159
+ Creates a queue identity given a Queue name
160
+ </pre>
161
+ <p>
162
+ create_stream_message()
163
+ </p>
164
+ <pre>
165
+ Creates a StreamMessage object
166
+
167
+ create_temporary_queue()
168
+ Creates a TemporaryQueue object
169
+
170
+ create_temporary_topic()
171
+ Creates a TemporaryTopic object
172
+
173
+ create_text_message()
174
+ Creates a TextMessage object
175
+
176
+ create_text_message(text)
177
+ Creates an initialized TextMessage object
178
+ </pre>
179
+ <p>
180
+ create_topic(topic_name)
181
+ </p>
182
+ <pre>
183
+ Creates a topic identity given a Topic name
184
+ </pre>
185
+ <p>
186
+ acknowledge_mode()
187
+ </p>
188
+ <pre>
189
+ Returns the acknowledgement mode of the session
190
+
191
+ message_listener()
192
+ Returns the session's distinguished message listener (optional).
193
+ </pre>
194
+ <p>
195
+ transacted?
196
+ </p>
197
+ <pre>
198
+ Indicates whether the session is in transacted mode
199
+ </pre>
200
+ <p>
201
+ recover()
202
+ </p>
203
+ <pre>
204
+ Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message
205
+ </pre>
206
+ <p>
207
+ rollback()
208
+ </p>
209
+ <pre>
210
+ Rolls back any messages done in this transaction and releases any locks currently held
211
+ </pre>
212
+ <p>
213
+ message_listener=(MessageListener listener)
214
+ </p>
215
+ <pre>
216
+ Sets the session's distinguished message listener (optional)
217
+ </pre>
218
+ <p>
219
+ unsubscribe(name)
220
+ </p>
221
+ <pre>
222
+ Unsubscribes a durable subscription that has been created by a client
223
+ </pre>
224
+ <p>
225
+ Interface javax.jms.<a href="Session.html">Session</a>
226
+ </p>
227
+
228
+ </div>
229
+
230
+
231
+ </div>
232
+
233
+ <div id="method-list">
234
+ <h3 class="section-bar">Methods</h3>
235
+
236
+ <div class="name-list">
237
+ <a href="#M000063">browse</a>&nbsp;&nbsp;
238
+ <a href="#M000062">browser</a>&nbsp;&nbsp;
239
+ <a href="#M000061">consume</a>&nbsp;&nbsp;
240
+ <a href="#M000060">consumer</a>&nbsp;&nbsp;
241
+ <a href="#M000053">create_destination</a>&nbsp;&nbsp;
242
+ <a href="#M000054">destination</a>&nbsp;&nbsp;
243
+ <a href="#M000052">message</a>&nbsp;&nbsp;
244
+ <a href="#M000059">producer</a>&nbsp;&nbsp;
245
+ <a href="#M000055">queue</a>&nbsp;&nbsp;
246
+ <a href="#M000056">temporary_queue</a>&nbsp;&nbsp;
247
+ <a href="#M000058">temporary_topic</a>&nbsp;&nbsp;
248
+ <a href="#M000057">topic</a>&nbsp;&nbsp;
249
+ </div>
250
+ </div>
251
+
252
+ </div>
253
+
254
+
255
+ <!-- if includes -->
256
+
257
+ <div id="section">
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+ <!-- if method_list -->
267
+ <div id="methods">
268
+ <h3 class="section-bar">Public Instance methods</h3>
269
+
270
+ <div id="method-M000063" class="method-detail">
271
+ <a name="M000063"></a>
272
+
273
+ <div class="method-heading">
274
+ <a href="#M000063" class="method-signature">
275
+ <span class="method-name">browse</span><span class="method-args">(params={}, &amp;proc)</span>
276
+ </a>
277
+ </div>
278
+
279
+ <div class="method-description">
280
+ <p>
281
+ Browse the specified <a href="Session.html#M000055">queue</a>, calling the
282
+ Proc supplied for each <a href="Session.html#M000052">message</a> found
283
+ </p>
284
+ <p>
285
+ Parameters:
286
+ </p>
287
+ <pre>
288
+ :queue_name =&gt; String: Name of the Queue to return
289
+ Symbol: :temporary =&gt; Create temporary queue
290
+ Mandatory unless :topic_name is supplied
291
+ Or,
292
+ :destination=&gt; Explicit javaxJms::Destination to use
293
+
294
+ :selector =&gt; Filter which messages should be returned from the queue
295
+ Default: All messages
296
+ </pre>
297
+ <p><a class="source-toggle" href="#"
298
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
299
+ <div class="method-source-code" id="M000063-source">
300
+ <pre>
301
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 437</span>
302
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">browse</span>(<span class="ruby-identifier">params</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
303
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">browser</span>(<span class="ruby-identifier">params</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">each</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)}
304
+ <span class="ruby-keyword kw">end</span>
305
+ </pre>
306
+ </div>
307
+ </div>
308
+ </div>
309
+
310
+ <div id="method-M000062" class="method-detail">
311
+ <a name="M000062"></a>
312
+
313
+ <div class="method-heading">
314
+ <a href="#M000062" class="method-signature">
315
+ <span class="method-name">browser</span><span class="method-args">(params, &amp;proc)</span>
316
+ </a>
317
+ </div>
318
+
319
+ <div class="method-description">
320
+ <p>
321
+ Return a <a href="Session.html#M000062">browser</a> for the <a
322
+ href="Session.html#M000054">destination</a> A <a
323
+ href="Session.html#M000062">browser</a> can read messages non-destructively
324
+ from the <a href="Session.html#M000055">queue</a> It cannot <a
325
+ href="Session.html#M000063">browse</a> Topics!
326
+ </p>
327
+ <p>
328
+ Call the Proc if supplied, then automatically close the <a
329
+ href="Session.html#M000060">consumer</a>
330
+ </p>
331
+ <p>
332
+ Parameters:
333
+ </p>
334
+ <pre>
335
+ :queue_name =&gt; String: Name of the Queue to return
336
+ Symbol: :temporary =&gt; Create temporary queue
337
+ Mandatory unless :topic_name is supplied
338
+ Or,
339
+ :destination=&gt; Explicit javaxJms::Destination to use
340
+
341
+ :selector =&gt; Filter which messages should be returned from the queue
342
+ Default: All messages
343
+ </pre>
344
+ <p><a class="source-toggle" href="#"
345
+ onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
346
+ <div class="method-source-code" id="M000062-source">
347
+ <pre>
348
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 404</span>
349
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">browser</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
350
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Session::browser requires a code block to be executed&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">proc</span>
351
+
352
+ <span class="ruby-identifier">destination</span> = <span class="ruby-identifier">create_destination</span>(<span class="ruby-identifier">params</span>)
353
+ <span class="ruby-identifier">b</span> = <span class="ruby-keyword kw">nil</span>
354
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:selector</span>]
355
+ <span class="ruby-identifier">b</span> = <span class="ruby-identifier">create_browser</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:selector</span>])
356
+ <span class="ruby-keyword kw">else</span>
357
+ <span class="ruby-identifier">b</span> = <span class="ruby-identifier">create_browser</span>(<span class="ruby-identifier">destination</span>)
358
+ <span class="ruby-keyword kw">end</span>
359
+
360
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">proc</span>
361
+ <span class="ruby-keyword kw">begin</span>
362
+ <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">b</span>)
363
+ <span class="ruby-keyword kw">ensure</span>
364
+ <span class="ruby-identifier">b</span>.<span class="ruby-identifier">close</span>
365
+ <span class="ruby-identifier">b</span> = <span class="ruby-keyword kw">nil</span>
366
+ <span class="ruby-keyword kw">end</span>
367
+ <span class="ruby-keyword kw">end</span>
368
+ <span class="ruby-identifier">b</span>
369
+ <span class="ruby-keyword kw">end</span>
370
+ </pre>
371
+ </div>
372
+ </div>
373
+ </div>
374
+
375
+ <div id="method-M000061" class="method-detail">
376
+ <a name="M000061"></a>
377
+
378
+ <div class="method-heading">
379
+ <a href="#M000061" class="method-signature">
380
+ <span class="method-name">consume</span><span class="method-args">(params, &amp;proc)</span>
381
+ </a>
382
+ </div>
383
+
384
+ <div class="method-description">
385
+ <p>
386
+ Consume all messages for the <a href="Session.html#M000054">destination</a>
387
+ A <a href="Session.html#M000060">consumer</a> can read messages from the <a
388
+ href="Session.html#M000055">queue</a> or <a
389
+ href="Session.html#M000057">topic</a>
390
+ </p>
391
+ <p>
392
+ Parameters:
393
+ </p>
394
+ <pre>
395
+ :queue_name =&gt; String: Name of the Queue to return
396
+ Symbol: :temporary =&gt; Create temporary queue
397
+ Mandatory unless :topic_name is supplied
398
+ Or,
399
+ :topic_name =&gt; String: Name of the Topic to write to or subscribe to
400
+ Symbol: :temporary =&gt; Create temporary topic
401
+ Mandatory unless :queue_name is supplied
402
+ Or,
403
+ :destination=&gt; Explicit javaxJms::Destination to use
404
+
405
+ :selector =&gt; Filter which messages should be returned from the queue
406
+ Default: All messages
407
+ :no_local =&gt; Determine whether messages published by its own connection
408
+ should be delivered to it
409
+ Default: false
410
+
411
+ :timeout Follows the rules for MQSeries:
412
+ -1 : Wait forever
413
+ 0 : Return immediately if no message is available
414
+ x : Wait for x milli-seconds for a message to be received from the broker
415
+ Note: Messages may still be on the queue, but the broker has not supplied any messages
416
+ in the time interval specified
417
+ Default: 0
418
+ </pre>
419
+ <p><a class="source-toggle" href="#"
420
+ onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
421
+ <div class="method-source-code" id="M000061-source">
422
+ <pre>
423
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 380</span>
424
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">consume</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
425
+ <span class="ruby-identifier">c</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">consumer</span>(<span class="ruby-identifier">params</span>)
426
+ <span class="ruby-keyword kw">begin</span>
427
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">each</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
428
+ <span class="ruby-keyword kw">ensure</span>
429
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">close</span>
430
+ <span class="ruby-keyword kw">end</span>
431
+ <span class="ruby-keyword kw">end</span>
432
+ </pre>
433
+ </div>
434
+ </div>
435
+ </div>
436
+
437
+ <div id="method-M000060" class="method-detail">
438
+ <a name="M000060"></a>
439
+
440
+ <div class="method-heading">
441
+ <a href="#M000060" class="method-signature">
442
+ <span class="method-name">consumer</span><span class="method-args">(params, &amp;proc)</span>
443
+ </a>
444
+ </div>
445
+
446
+ <div class="method-description">
447
+ <p>
448
+ Return a <a href="Session.html#M000060">consumer</a> for the <a
449
+ href="Session.html#M000054">destination</a> A <a
450
+ href="Session.html#M000060">consumer</a> can read messages from the <a
451
+ href="Session.html#M000055">queue</a> or <a
452
+ href="Session.html#M000057">topic</a>
453
+ </p>
454
+ <p>
455
+ Call the Proc if supplied, then automatically close the <a
456
+ href="Session.html#M000060">consumer</a>
457
+ </p>
458
+ <p>
459
+ Parameters:
460
+ </p>
461
+ <pre>
462
+ :queue_name =&gt; String: Name of the Queue to return
463
+ Symbol: :temporary =&gt; Create temporary queue
464
+ Mandatory unless :topic_name is supplied
465
+ Or,
466
+ :topic_name =&gt; String: Name of the Topic to write to or subscribe to
467
+ Symbol: :temporary =&gt; Create temporary topic
468
+ Mandatory unless :queue_name is supplied
469
+ Or,
470
+ :destination=&gt; Explicit javaxJms::Destination to use
471
+
472
+ :selector =&gt; Filter which messages should be returned from the queue
473
+ Default: All messages
474
+ :no_local =&gt; Determine whether messages published by its own connection
475
+ should be delivered to it
476
+ Default: false
477
+ </pre>
478
+ <p><a class="source-toggle" href="#"
479
+ onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
480
+ <div class="method-source-code" id="M000060-source">
481
+ <pre>
482
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 330</span>
483
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">consumer</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
484
+ <span class="ruby-identifier">destination</span> = <span class="ruby-identifier">create_destination</span>(<span class="ruby-identifier">params</span>)
485
+ <span class="ruby-identifier">c</span> = <span class="ruby-keyword kw">nil</span>
486
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:no_local</span>]
487
+ <span class="ruby-identifier">c</span> = <span class="ruby-identifier">create_consumer</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:selector</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:no_local</span>])
488
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:selector</span>]
489
+ <span class="ruby-identifier">c</span> = <span class="ruby-identifier">create_consumer</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:selector</span>])
490
+ <span class="ruby-keyword kw">else</span>
491
+ <span class="ruby-identifier">c</span> = <span class="ruby-identifier">create_consumer</span>(<span class="ruby-identifier">destination</span>)
492
+ <span class="ruby-keyword kw">end</span>
493
+
494
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">proc</span>
495
+ <span class="ruby-keyword kw">begin</span>
496
+ <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">c</span>)
497
+ <span class="ruby-keyword kw">ensure</span>
498
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">close</span>
499
+ <span class="ruby-identifier">c</span> = <span class="ruby-keyword kw">nil</span>
500
+ <span class="ruby-keyword kw">end</span>
501
+ <span class="ruby-keyword kw">end</span>
502
+ <span class="ruby-identifier">c</span>
503
+ <span class="ruby-keyword kw">end</span>
504
+ </pre>
505
+ </div>
506
+ </div>
507
+ </div>
508
+
509
+ <div id="method-M000053" class="method-detail">
510
+ <a name="M000053"></a>
511
+
512
+ <div class="method-heading">
513
+ <a href="#M000053" class="method-signature">
514
+ <span class="method-name">create_destination</span><span class="method-args">(params)</span>
515
+ </a>
516
+ </div>
517
+
518
+ <div class="method-description">
519
+ <p>
520
+ Create the <a href="Session.html#M000054">destination</a> based on the
521
+ parameter supplied
522
+ </p>
523
+ <p>
524
+ The idea behind this method is to allow the decision as to whether one is
525
+ sending to a <a href="Session.html#M000057">topic</a> or <a
526
+ href="Session.html#M000054">destination</a> to be transparent to the code.
527
+ The supplied parameters can be externalized into say a YAML file so that
528
+ today it writes to a <a href="Session.html#M000055">queue</a>, later it can
529
+ be changed to write to a <a href="Session.html#M000057">topic</a> so that
530
+ multiple parties can receive the same messages.
531
+ </p>
532
+ <p>
533
+ Note: For Temporary Queues and Topics, remember to delete them when done
534
+ </p>
535
+ <pre>
536
+ or just use ::destination instead with a block and it will take care
537
+ of deleting them for you
538
+ </pre>
539
+ <p>
540
+ To create a <a href="Session.html#M000055">queue</a>:
541
+ </p>
542
+ <pre>
543
+ session.create_destination(:queue_name =&gt; 'name of queue')
544
+ </pre>
545
+ <p>
546
+ To create a temporary <a href="Session.html#M000055">queue</a>:
547
+ </p>
548
+ <pre>
549
+ session.create_destination(:queue_name =&gt; :temporary)
550
+ </pre>
551
+ <p>
552
+ To create a <a href="Session.html#M000057">topic</a>:
553
+ </p>
554
+ <pre>
555
+ session.create_destination(:topic_name =&gt; 'name of queue')
556
+ </pre>
557
+ <p>
558
+ To create a temporary <a href="Session.html#M000057">topic</a>:
559
+ </p>
560
+ <pre>
561
+ session.create_destination(:topic_name =&gt; :temporary)
562
+ </pre>
563
+ <p>
564
+ Create the <a href="Session.html#M000054">destination</a> based on the
565
+ parameter supplied
566
+ </p>
567
+ <p>
568
+ Parameters:
569
+ </p>
570
+ <pre>
571
+ :queue_name =&gt; String: Name of the Queue to return
572
+ Symbol: :temporary =&gt; Create temporary queue
573
+ Mandatory unless :topic_name is supplied
574
+ Or,
575
+ :topic_name =&gt; String: Name of the Topic to write to or subscribe to
576
+ Symbol: :temporary =&gt; Create temporary topic
577
+ Mandatory unless :queue_name is supplied
578
+ Or,
579
+ :destination=&gt; Explicit javaxJms::Destination to use
580
+ </pre>
581
+ <p>
582
+ Returns the result of the supplied block
583
+ </p>
584
+ <p><a class="source-toggle" href="#"
585
+ onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
586
+ <div class="method-source-code" id="M000053-source">
587
+ <pre>
588
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 170</span>
589
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_destination</span>(<span class="ruby-identifier">params</span>)
590
+ <span class="ruby-comment cmt"># Allow a Java JMS destination object to be passed in</span>
591
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:destination</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:destination</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:destination</span>].<span class="ruby-identifier">java_kind_of?</span>(<span class="ruby-constant">JMS</span><span class="ruby-operator">::</span><span class="ruby-constant">Destination</span>)
592
+
593
+ <span class="ruby-comment cmt"># :q_name is deprecated</span>
594
+ <span class="ruby-identifier">queue_name</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:queue_name</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:q_name</span>]
595
+ <span class="ruby-identifier">topic_name</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:topic_name</span>]
596
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Missing mandatory parameter :queue_name or :topic_name to Session::producer, Session::consumer, or Session::browser&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">queue_name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">topic_name</span>
597
+
598
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">queue_name</span>
599
+ <span class="ruby-identifier">queue_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:temporary</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">create_temporary_queue</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">create_queue</span>(<span class="ruby-identifier">queue_name</span>)
600
+ <span class="ruby-keyword kw">else</span>
601
+ <span class="ruby-identifier">topic_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:temporary</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">create_temporary_topic</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">create_topic</span>(<span class="ruby-identifier">topic_name</span>)
602
+ <span class="ruby-keyword kw">end</span>
603
+ <span class="ruby-keyword kw">end</span>
604
+ </pre>
605
+ </div>
606
+ </div>
607
+ </div>
608
+
609
+ <div id="method-M000054" class="method-detail">
610
+ <a name="M000054"></a>
611
+
612
+ <div class="method-heading">
613
+ <a href="#M000054" class="method-signature">
614
+ <span class="method-name">destination</span><span class="method-args">(params={}, &amp;block)</span>
615
+ </a>
616
+ </div>
617
+
618
+ <div class="method-description">
619
+ <p>
620
+ Create a <a href="Session.html#M000055">queue</a> or <a
621
+ href="Session.html#M000057">topic</a> to send or receive messages from
622
+ </p>
623
+ <p>
624
+ A block must be supplied so that if it is a temporary <a
625
+ href="Session.html#M000057">topic</a> or <a
626
+ href="Session.html#M000055">queue</a> it will be deleted after the proc is
627
+ complete
628
+ </p>
629
+ <p>
630
+ To create a <a href="Session.html#M000055">queue</a>:
631
+ </p>
632
+ <pre>
633
+ session.destination(:queue_name =&gt; 'name of queue')
634
+ </pre>
635
+ <p>
636
+ To create a temporary <a href="Session.html#M000055">queue</a>:
637
+ </p>
638
+ <pre>
639
+ session.destination(:queue_name =&gt; :temporary)
640
+ </pre>
641
+ <p>
642
+ To create a <a href="Session.html#M000057">topic</a>:
643
+ </p>
644
+ <pre>
645
+ session.destination(:topic_name =&gt; 'name of queue')
646
+ </pre>
647
+ <p>
648
+ To create a temporary <a href="Session.html#M000057">topic</a>:
649
+ </p>
650
+ <pre>
651
+ session.destination(:topic_name =&gt; :temporary)
652
+ </pre>
653
+ <p>
654
+ Create the <a href="Session.html#M000054">destination</a> based on the
655
+ parameter supplied
656
+ </p>
657
+ <p>
658
+ Parameters:
659
+ </p>
660
+ <pre>
661
+ :queue_name =&gt; String: Name of the Queue to return
662
+ Symbol: :temporary =&gt; Create temporary queue
663
+ Mandatory unless :topic_name is supplied
664
+ Or,
665
+ :topic_name =&gt; String: Name of the Topic to write to or subscribe to
666
+ Symbol: :temporary =&gt; Create temporary topic
667
+ Mandatory unless :queue_name is supplied
668
+ Or,
669
+ :destination=&gt; Explicit javaxJms::Destination to use
670
+ </pre>
671
+ <p>
672
+ Returns the result of the supplied block
673
+ </p>
674
+ <p><a class="source-toggle" href="#"
675
+ onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
676
+ <div class="method-source-code" id="M000054-source">
677
+ <pre>
678
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 217</span>
679
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destination</span>(<span class="ruby-identifier">params</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
680
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Missing mandatory Block when calling JMS::Session#destination&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>
681
+ <span class="ruby-identifier">dest</span> = <span class="ruby-keyword kw">nil</span>
682
+ <span class="ruby-keyword kw">begin</span>
683
+ <span class="ruby-identifier">dest</span> = <span class="ruby-identifier">create_destination</span>(<span class="ruby-identifier">params</span>)
684
+ <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">dest</span>)
685
+ <span class="ruby-keyword kw">ensure</span>
686
+ <span class="ruby-comment cmt"># Delete Temporary Queue / Topic</span>
687
+ <span class="ruby-identifier">dest</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dest</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dest</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:delete</span>)
688
+ <span class="ruby-keyword kw">end</span>
689
+ <span class="ruby-keyword kw">end</span>
690
+ </pre>
691
+ </div>
692
+ </div>
693
+ </div>
694
+
695
+ <div id="method-M000052" class="method-detail">
696
+ <a name="M000052"></a>
697
+
698
+ <div class="method-heading">
699
+ <a href="#M000052" class="method-signature">
700
+ <span class="method-name">message</span><span class="method-args">(data)</span>
701
+ </a>
702
+ </div>
703
+
704
+ <div class="method-description">
705
+ <p>
706
+ Create a new <a href="Session.html#M000052">message</a> instance based on
707
+ the type of the data being supplied
708
+ </p>
709
+ <pre>
710
+ String (:to_str) =&gt; TextMessage
711
+ Hash (:each_pair) =&gt; MapMessage
712
+ </pre>
713
+ <p>
714
+ Duck typing is used to determine the type. If the class responds to :to_str
715
+ then it is considered a String. Similarly if it responds to :each_pair it
716
+ is considered to be a Hash
717
+ </p>
718
+ <p><a class="source-toggle" href="#"
719
+ onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
720
+ <div class="method-source-code" id="M000052-source">
721
+ <pre>
722
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 118</span>
723
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>(<span class="ruby-identifier">data</span>)
724
+ <span class="ruby-identifier">jms_message</span> = <span class="ruby-keyword kw">nil</span>
725
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_str</span>, <span class="ruby-keyword kw">false</span>)
726
+ <span class="ruby-identifier">jms_message</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">createTextMessage</span>
727
+ <span class="ruby-identifier">jms_message</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_str</span>
728
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:each_pair</span>, <span class="ruby-keyword kw">false</span>)
729
+ <span class="ruby-identifier">jms_message</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">createMapMessage</span>
730
+ <span class="ruby-identifier">jms_message</span>.<span class="ruby-identifier">data</span> = <span class="ruby-identifier">data</span>
731
+ <span class="ruby-keyword kw">else</span>
732
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown data type #{data.class.to_s} in Message&quot;</span>
733
+ <span class="ruby-keyword kw">end</span>
734
+ <span class="ruby-identifier">jms_message</span>
735
+ <span class="ruby-keyword kw">end</span>
736
+ </pre>
737
+ </div>
738
+ </div>
739
+ </div>
740
+
741
+ <div id="method-M000059" class="method-detail">
742
+ <a name="M000059"></a>
743
+
744
+ <div class="method-heading">
745
+ <a href="#M000059" class="method-signature">
746
+ <span class="method-name">producer</span><span class="method-args">(params, &amp;proc)</span>
747
+ </a>
748
+ </div>
749
+
750
+ <div class="method-description">
751
+ <p>
752
+ Return a <a href="Session.html#M000059">producer</a> for the <a
753
+ href="Session.html#M000055">queue</a> name supplied A <a
754
+ href="Session.html#M000059">producer</a> supports sending messages to a
755
+ Queue or a Topic
756
+ </p>
757
+ <p>
758
+ Call the Proc if supplied, then automatically close the <a
759
+ href="Session.html#M000059">producer</a>
760
+ </p>
761
+ <p>
762
+ Parameters:
763
+ </p>
764
+ <pre>
765
+ :queue_name =&gt; String: Name of the Queue to return
766
+ Symbol: :temporary =&gt; Create temporary queue
767
+ Mandatory unless :topic_name is supplied
768
+ Or,
769
+ :topic_name =&gt; String: Name of the Topic to write to or subscribe to
770
+ Symbol: :temporary =&gt; Create temporary topic
771
+ Mandatory unless :queue_name is supplied
772
+ Or,
773
+ :destination=&gt; Explicit JMS::Destination to use
774
+ </pre>
775
+ <p><a class="source-toggle" href="#"
776
+ onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
777
+ <div class="method-source-code" id="M000059-source">
778
+ <pre>
779
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 296</span>
780
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">producer</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
781
+ <span class="ruby-identifier">p</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create_producer</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create_destination</span>(<span class="ruby-identifier">params</span>))
782
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">proc</span>
783
+ <span class="ruby-keyword kw">begin</span>
784
+ <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">p</span>)
785
+ <span class="ruby-keyword kw">ensure</span>
786
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">close</span>
787
+ <span class="ruby-identifier">p</span> = <span class="ruby-keyword kw">nil</span>
788
+ <span class="ruby-keyword kw">end</span>
789
+ <span class="ruby-keyword kw">end</span>
790
+ <span class="ruby-identifier">p</span>
791
+ <span class="ruby-keyword kw">end</span>
792
+ </pre>
793
+ </div>
794
+ </div>
795
+ </div>
796
+
797
+ <div id="method-M000055" class="method-detail">
798
+ <a name="M000055"></a>
799
+
800
+ <div class="method-heading">
801
+ <a href="#M000055" class="method-signature">
802
+ <span class="method-name">queue</span><span class="method-args">(queue_name, &amp;block)</span>
803
+ </a>
804
+ </div>
805
+
806
+ <div class="method-description">
807
+ <p>
808
+ Return the <a href="Session.html#M000055">queue</a> matching the <a
809
+ href="Session.html#M000055">queue</a> name supplied Call the Proc if
810
+ supplied
811
+ </p>
812
+ <p><a class="source-toggle" href="#"
813
+ onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
814
+ <div class="method-source-code" id="M000055-source">
815
+ <pre>
816
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 231</span>
817
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">queue</span>(<span class="ruby-identifier">queue_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
818
+ <span class="ruby-identifier">q</span> = <span class="ruby-identifier">create_queue</span>(<span class="ruby-identifier">queue_name</span>)
819
+ <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">q</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
820
+ <span class="ruby-identifier">q</span>
821
+ <span class="ruby-keyword kw">end</span>
822
+ </pre>
823
+ </div>
824
+ </div>
825
+ </div>
826
+
827
+ <div id="method-M000056" class="method-detail">
828
+ <a name="M000056"></a>
829
+
830
+ <div class="method-heading">
831
+ <a href="#M000056" class="method-signature">
832
+ <span class="method-name">temporary_queue</span><span class="method-args">(&amp;block)</span>
833
+ </a>
834
+ </div>
835
+
836
+ <div class="method-description">
837
+ <p>
838
+ Return a temporary <a href="Session.html#M000055">queue</a> The temporary
839
+ <a href="Session.html#M000055">queue</a> is deleted once the block
840
+ completes If no block is supplied then it should be deleted by the caller
841
+ when no longer needed
842
+ </p>
843
+ <p><a class="source-toggle" href="#"
844
+ onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
845
+ <div class="method-source-code" id="M000056-source">
846
+ <pre>
847
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 241</span>
848
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temporary_queue</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
849
+ <span class="ruby-identifier">q</span> = <span class="ruby-identifier">create_temporary_queue</span>
850
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
851
+ <span class="ruby-keyword kw">begin</span>
852
+ <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">q</span>)
853
+ <span class="ruby-keyword kw">ensure</span>
854
+ <span class="ruby-comment cmt"># Delete Temporary queue on completion of block</span>
855
+ <span class="ruby-identifier">q</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">q</span>
856
+ <span class="ruby-identifier">q</span> = <span class="ruby-keyword kw">nil</span>
857
+ <span class="ruby-keyword kw">end</span>
858
+ <span class="ruby-keyword kw">end</span>
859
+ <span class="ruby-identifier">q</span>
860
+ <span class="ruby-keyword kw">end</span>
861
+ </pre>
862
+ </div>
863
+ </div>
864
+ </div>
865
+
866
+ <div id="method-M000058" class="method-detail">
867
+ <a name="M000058"></a>
868
+
869
+ <div class="method-heading">
870
+ <a href="#M000058" class="method-signature">
871
+ <span class="method-name">temporary_topic</span><span class="method-args">(&amp;block)</span>
872
+ </a>
873
+ </div>
874
+
875
+ <div class="method-description">
876
+ <p>
877
+ Return a temporary <a href="Session.html#M000057">topic</a> The temporary
878
+ <a href="Session.html#M000057">topic</a> is deleted once the block
879
+ completes If no block is supplied then it should be deleted by the caller
880
+ when no longer needed
881
+ </p>
882
+ <p><a class="source-toggle" href="#"
883
+ onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
884
+ <div class="method-source-code" id="M000058-source">
885
+ <pre>
886
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 267</span>
887
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temporary_topic</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
888
+ <span class="ruby-identifier">t</span> = <span class="ruby-identifier">create_temporary_topic</span>
889
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
890
+ <span class="ruby-keyword kw">begin</span>
891
+ <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">t</span>)
892
+ <span class="ruby-keyword kw">ensure</span>
893
+ <span class="ruby-comment cmt"># Delete Temporary topic on completion of block</span>
894
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>
895
+ <span class="ruby-identifier">t</span> = <span class="ruby-keyword kw">nil</span>
896
+ <span class="ruby-keyword kw">end</span>
897
+ <span class="ruby-keyword kw">end</span>
898
+ <span class="ruby-identifier">t</span>
899
+ <span class="ruby-keyword kw">end</span>
900
+ </pre>
901
+ </div>
902
+ </div>
903
+ </div>
904
+
905
+ <div id="method-M000057" class="method-detail">
906
+ <a name="M000057"></a>
907
+
908
+ <div class="method-heading">
909
+ <a href="#M000057" class="method-signature">
910
+ <span class="method-name">topic</span><span class="method-args">(topic_name, &amp;proc)</span>
911
+ </a>
912
+ </div>
913
+
914
+ <div class="method-description">
915
+ <p>
916
+ Return the <a href="Session.html#M000057">topic</a> matching the <a
917
+ href="Session.html#M000057">topic</a> name supplied Call the Proc if
918
+ supplied
919
+ </p>
920
+ <p><a class="source-toggle" href="#"
921
+ onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
922
+ <div class="method-source-code" id="M000057-source">
923
+ <pre>
924
+ <span class="ruby-comment cmt"># File lib/jms/session.rb, line 257</span>
925
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">topic</span>(<span class="ruby-identifier">topic_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
926
+ <span class="ruby-identifier">t</span> = <span class="ruby-identifier">create_topic</span>(<span class="ruby-identifier">topic_name</span>)
927
+ <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">t</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">proc</span>
928
+ <span class="ruby-identifier">t</span>
929
+ <span class="ruby-keyword kw">end</span>
930
+ </pre>
931
+ </div>
932
+ </div>
933
+ </div>
934
+
935
+
936
+ </div>
937
+
938
+
939
+ </div>
940
+
941
+
942
+ <div id="validator-badges">
943
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
944
+ </div>
945
+
946
+ </body>
947
+ </html>