jruby-jms 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +15 -0
- data/README.md +27 -28
- data/Rakefile +7 -1
- data/doc/classes/JMS.html +265 -0
- data/doc/classes/JMS/BytesMessage.html +215 -0
- data/doc/classes/JMS/Connection.html +1145 -0
- data/doc/classes/JMS/MapMessage.html +333 -0
- data/doc/classes/JMS/Message.html +1085 -0
- data/doc/classes/JMS/MessageConsumer.html +316 -0
- data/doc/classes/JMS/MessageListenerImpl.html +262 -0
- data/doc/classes/JMS/ObjectMessage.html +170 -0
- data/doc/classes/JMS/OracleAQConnectionFactory.html +184 -0
- data/doc/classes/JMS/QueueBrowser.html +155 -0
- data/doc/classes/JMS/Session.html +947 -0
- data/doc/classes/JMS/SessionPool.html +411 -0
- data/doc/classes/JMS/TextMessage.html +194 -0
- data/doc/created.rid +1 -0
- data/doc/files/README_md.html +440 -0
- data/doc/files/lib/jms/bytes_message_rb.html +122 -0
- data/doc/files/lib/jms/connection_rb.html +140 -0
- data/doc/files/lib/jms/imports_rb.html +108 -0
- data/doc/files/lib/jms/logging_rb.html +129 -0
- data/doc/files/lib/jms/map_message_rb.html +122 -0
- data/doc/files/lib/jms/message_consumer_rb.html +122 -0
- data/doc/files/lib/jms/message_listener_impl_rb.html +122 -0
- data/doc/files/lib/jms/message_rb.html +122 -0
- data/doc/files/lib/jms/object_message_rb.html +122 -0
- data/doc/files/lib/jms/oracle_a_q_connection_factory_rb.html +122 -0
- data/doc/files/lib/jms/queue_browser_rb.html +122 -0
- data/doc/files/lib/jms/session_pool_rb.html +108 -0
- data/doc/files/lib/jms/session_rb.html +164 -0
- data/doc/files/lib/jms/text_message_rb.html +122 -0
- data/doc/files/lib/jms_rb.html +131 -0
- data/doc/fr_class_index.html +39 -0
- data/doc/fr_file_index.html +42 -0
- data/doc/fr_method_index.html +120 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/advanced/session_pool.rb +37 -0
- data/examples/client-server/replier.rb +29 -0
- data/examples/client-server/requestor.rb +40 -0
- data/examples/jms.yml +85 -9
- data/examples/performance/consumer.rb +6 -8
- data/examples/performance/producer.rb +10 -10
- data/examples/producer-consumer/browser.rb +24 -0
- data/examples/{consumer.rb → producer-consumer/consumer.rb} +5 -4
- data/examples/producer-consumer/consumer_async.rb +30 -0
- data/examples/{producer.rb → producer-consumer/producer.rb} +5 -3
- data/examples/publish-subscribe/publish.rb +24 -0
- data/examples/publish-subscribe/subscribe.rb +31 -0
- data/lib/jms/bytes_message.rb +52 -0
- data/lib/jms/connection.rb +170 -162
- data/lib/jms/imports.rb +21 -0
- data/lib/jms/logging.rb +17 -1
- data/lib/jms/{javax_jms_map_message.rb → map_message.rb} +2 -2
- data/lib/jms/message.rb +285 -0
- data/lib/jms/{javax_jms_message_consumer.rb → message_consumer.rb} +6 -3
- data/lib/jms/{message_listener.rb → message_listener_impl.rb} +3 -3
- data/lib/jms/{javax_jms_object_message.rb → object_message.rb} +1 -1
- data/lib/jms/oracle_a_q_connection_factory.rb +35 -0
- data/lib/jms/{javax_jms_queue_browser.rb → queue_browser.rb} +5 -4
- data/lib/jms/{javax_jms_session.rb → session.rb} +23 -25
- data/lib/jms/session_pool.rb +148 -0
- data/lib/jms/{javax_jms_text_message.rb → text_message.rb} +1 -1
- data/test/connection_test.rb +31 -29
- data/test/jms.yml +8 -9
- data/test/message_test.rb +29 -29
- data/test/session_test.rb +39 -39
- metadata +62 -22
- data/lib/jms/javax_jms_message.rb +0 -264
@@ -0,0 +1,411 @@
|
|
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>Class: JMS::SessionPool</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">JMS::SessionPool</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/jms/session_pool_rb.html">
|
59
|
+
lib/jms/session_pool.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Since a <a href="Session.html">Session</a> can only be used by one thread
|
84
|
+
at a time, we could create a <a href="Session.html">Session</a> for every
|
85
|
+
thread. That could result in excessive unused Sessions. An alternative is
|
86
|
+
to create a pool of sessions that can be shared by multiple threads.
|
87
|
+
</p>
|
88
|
+
<p>
|
89
|
+
Each thread can request a <a href="SessionPool.html#M000091">session</a>
|
90
|
+
and then return it once it is no longer needed by that thread. The only way
|
91
|
+
to get a <a href="SessionPool.html#M000091">session</a> is pass a block so
|
92
|
+
that the <a href="Session.html">Session</a> is automatically returned to
|
93
|
+
the pool upon completion of the block.
|
94
|
+
</p>
|
95
|
+
<p>
|
96
|
+
Parameters:
|
97
|
+
</p>
|
98
|
+
<pre>
|
99
|
+
see regular session parameters from: JMS::Connection#initialize
|
100
|
+
</pre>
|
101
|
+
<p>
|
102
|
+
Additional parameters for controlling the <a
|
103
|
+
href="SessionPool.html#M000091">session</a> pool itself
|
104
|
+
</p>
|
105
|
+
<pre>
|
106
|
+
:pool_name Name of the pool as it shows up in the logger.
|
107
|
+
Default: 'JMS::SessionPool'
|
108
|
+
:pool_size Maximum Pool Size. Default: 10
|
109
|
+
The pool only grows as needed and will never exceed
|
110
|
+
:pool_size
|
111
|
+
:pool_warn_timeout Number of seconds to wait before logging a warning when a
|
112
|
+
session in the pool is not available. Measured in seconds
|
113
|
+
Default: 5.0
|
114
|
+
:pool_logger Supply a logger that responds to #debug, #info, #warn and #debug?
|
115
|
+
For example: Rails.logger
|
116
|
+
Default: None
|
117
|
+
</pre>
|
118
|
+
<p>
|
119
|
+
Example:
|
120
|
+
</p>
|
121
|
+
<pre>
|
122
|
+
session_pool = connection.create_session_pool(config)
|
123
|
+
session_pool.session do |session|
|
124
|
+
....
|
125
|
+
end
|
126
|
+
</pre>
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
130
|
+
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div id="method-list">
|
134
|
+
<h3 class="section-bar">Methods</h3>
|
135
|
+
|
136
|
+
<div class="name-list">
|
137
|
+
<a href="#M000094">close</a>
|
138
|
+
<a href="#M000092">consumer</a>
|
139
|
+
<a href="#M000090">new</a>
|
140
|
+
<a href="#M000093">producer</a>
|
141
|
+
<a href="#M000091">session</a>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
<!-- if includes -->
|
149
|
+
|
150
|
+
<div id="section">
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<!-- if method_list -->
|
160
|
+
<div id="methods">
|
161
|
+
<h3 class="section-bar">Public Class methods</h3>
|
162
|
+
|
163
|
+
<div id="method-M000090" class="method-detail">
|
164
|
+
<a name="M000090"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000090" class="method-signature">
|
168
|
+
<span class="method-name">new</span><span class="method-args">(connection, params={})</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p><a class="source-toggle" href="#"
|
174
|
+
onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
|
175
|
+
<div class="method-source-code" id="M000090-source">
|
176
|
+
<pre>
|
177
|
+
<span class="ruby-comment cmt"># File lib/jms/session_pool.rb, line 34</span>
|
178
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">params</span>={})
|
179
|
+
<span class="ruby-comment cmt"># Save Session params since it will be used every time a new session is</span>
|
180
|
+
<span class="ruby-comment cmt"># created in the pool</span>
|
181
|
+
<span class="ruby-identifier">session_params</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span>{} <span class="ruby-operator">:</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">dup</span>
|
182
|
+
<span class="ruby-identifier">logger</span> = <span class="ruby-identifier">session_params</span>[<span class="ruby-identifier">:pool_logger</span>]
|
183
|
+
<span class="ruby-comment cmt"># Define how GenePool can create new sessions</span>
|
184
|
+
<span class="ruby-ivar">@pool</span> = <span class="ruby-constant">GenePool</span>.<span class="ruby-identifier">new</span>(
|
185
|
+
<span class="ruby-identifier">:name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">session_params</span>[<span class="ruby-identifier">:pool_name</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>,
|
186
|
+
<span class="ruby-identifier">:pool_size</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">session_params</span>[<span class="ruby-identifier">:pool_size</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>,
|
187
|
+
<span class="ruby-identifier">:warn_timeout</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">session_params</span>[<span class="ruby-identifier">:pool_warn_timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">5</span>,
|
188
|
+
<span class="ruby-identifier">:logger</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">logger</span>) <span class="ruby-keyword kw">do</span>
|
189
|
+
<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">create_session</span>(<span class="ruby-identifier">session_params</span>)
|
190
|
+
<span class="ruby-keyword kw">end</span>
|
191
|
+
|
192
|
+
<span class="ruby-comment cmt"># Handle connection failures</span>
|
193
|
+
<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">on_exception</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">jms_exception</span><span class="ruby-operator">|</span>
|
194
|
+
<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">"JMS Connection Exception has occurred: #{jms_exception}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
195
|
+
<span class="ruby-comment cmt">#TODO: Close all sessions in the pool and release from the pool?</span>
|
196
|
+
<span class="ruby-keyword kw">end</span>
|
197
|
+
<span class="ruby-keyword kw">end</span>
|
198
|
+
</pre>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
204
|
+
|
205
|
+
<div id="method-M000094" class="method-detail">
|
206
|
+
<a name="M000094"></a>
|
207
|
+
|
208
|
+
<div class="method-heading">
|
209
|
+
<a href="#M000094" class="method-signature">
|
210
|
+
<span class="method-name">close</span><span class="method-args">()</span>
|
211
|
+
</a>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
<div class="method-description">
|
215
|
+
<p>
|
216
|
+
Immediately Close all sessions in the pool and release from the pool
|
217
|
+
</p>
|
218
|
+
<p>
|
219
|
+
TODO: Allow an option to wait for active sessions to be returned before
|
220
|
+
</p>
|
221
|
+
<pre>
|
222
|
+
closing
|
223
|
+
</pre>
|
224
|
+
<p><a class="source-toggle" href="#"
|
225
|
+
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
|
226
|
+
<div class="method-source-code" id="M000094-source">
|
227
|
+
<pre>
|
228
|
+
<span class="ruby-comment cmt"># File lib/jms/session_pool.rb, line 138</span>
|
229
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
|
230
|
+
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
231
|
+
<span class="ruby-comment cmt">#@pool.remove(s)</span>
|
232
|
+
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">close</span>
|
233
|
+
<span class="ruby-comment cmt">#@pool.remove(s)</span>
|
234
|
+
<span class="ruby-keyword kw">end</span>
|
235
|
+
<span class="ruby-keyword kw">end</span>
|
236
|
+
</pre>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div id="method-M000092" class="method-detail">
|
242
|
+
<a name="M000092"></a>
|
243
|
+
|
244
|
+
<div class="method-heading">
|
245
|
+
<a href="#M000092" class="method-signature">
|
246
|
+
<span class="method-name">consumer</span><span class="method-args">(params, &block)</span>
|
247
|
+
</a>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="method-description">
|
251
|
+
<p>
|
252
|
+
Obtain a <a href="SessionPool.html#M000091">session</a> from the pool and
|
253
|
+
create a <a href="MessageConsumer.html">MessageConsumer</a>. Pass both into
|
254
|
+
the supplied block. Once the block is complete the <a
|
255
|
+
href="SessionPool.html#M000092">consumer</a> is closed and the <a
|
256
|
+
href="SessionPool.html#M000091">session</a> is returned to the pool.
|
257
|
+
</p>
|
258
|
+
<p>
|
259
|
+
Parameters:
|
260
|
+
</p>
|
261
|
+
<pre>
|
262
|
+
:queue_name => String: Name of the Queue to return
|
263
|
+
Symbol: :temporary => Create temporary queue
|
264
|
+
Mandatory unless :topic_name is supplied
|
265
|
+
Or,
|
266
|
+
:topic_name => String: Name of the Topic to write to or subscribe to
|
267
|
+
Symbol: :temporary => Create temporary topic
|
268
|
+
Mandatory unless :queue_name is supplied
|
269
|
+
Or,
|
270
|
+
:destination=> Explicit javaxJms::Destination to use
|
271
|
+
|
272
|
+
:selector => Filter which messages should be returned from the queue
|
273
|
+
Default: All messages
|
274
|
+
:no_local => Determine whether messages published by its own connection
|
275
|
+
should be delivered to it
|
276
|
+
Default: false
|
277
|
+
</pre>
|
278
|
+
<p>
|
279
|
+
Example
|
280
|
+
</p>
|
281
|
+
<pre>
|
282
|
+
session_pool.consumer(:queue_name => 'MyQueue') do |session, consumer|
|
283
|
+
message = consumer.receive(timeout)
|
284
|
+
puts message.data if message
|
285
|
+
end
|
286
|
+
</pre>
|
287
|
+
<p><a class="source-toggle" href="#"
|
288
|
+
onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
|
289
|
+
<div class="method-source-code" id="M000092-source">
|
290
|
+
<pre>
|
291
|
+
<span class="ruby-comment cmt"># File lib/jms/session_pool.rb, line 90</span>
|
292
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">consumer</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
293
|
+
<span class="ruby-identifier">session</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
294
|
+
<span class="ruby-identifier">consumer</span> = <span class="ruby-keyword kw">nil</span>
|
295
|
+
<span class="ruby-keyword kw">begin</span>
|
296
|
+
<span class="ruby-identifier">consumer</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">consumer</span>(<span class="ruby-identifier">params</span>)
|
297
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">consumer</span>)
|
298
|
+
<span class="ruby-keyword kw">ensure</span>
|
299
|
+
<span class="ruby-identifier">consumer</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">consumer</span>
|
300
|
+
<span class="ruby-keyword kw">end</span>
|
301
|
+
<span class="ruby-keyword kw">end</span>
|
302
|
+
<span class="ruby-keyword kw">end</span>
|
303
|
+
</pre>
|
304
|
+
</div>
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
|
308
|
+
<div id="method-M000093" class="method-detail">
|
309
|
+
<a name="M000093"></a>
|
310
|
+
|
311
|
+
<div class="method-heading">
|
312
|
+
<a href="#M000093" class="method-signature">
|
313
|
+
<span class="method-name">producer</span><span class="method-args">(params, &block)</span>
|
314
|
+
</a>
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div class="method-description">
|
318
|
+
<p>
|
319
|
+
Obtain a <a href="SessionPool.html#M000091">session</a> from the pool and
|
320
|
+
create a MessageProducer. Pass both into the supplied block. Once the block
|
321
|
+
is complete the <a href="SessionPool.html#M000093">producer</a> is closed
|
322
|
+
and the <a href="SessionPool.html#M000091">session</a> is returned to the
|
323
|
+
pool.
|
324
|
+
</p>
|
325
|
+
<p>
|
326
|
+
Parameters:
|
327
|
+
</p>
|
328
|
+
<pre>
|
329
|
+
:queue_name => String: Name of the Queue to send messages to
|
330
|
+
Symbol: :temporary => Create temporary queue
|
331
|
+
Mandatory unless :topic_name is supplied
|
332
|
+
Or,
|
333
|
+
:topic_name => String: Name of the Topic to send message to
|
334
|
+
Symbol: :temporary => Create temporary topic
|
335
|
+
Mandatory unless :queue_name is supplied
|
336
|
+
Or,
|
337
|
+
:destination=> Explicit JMS::Destination to use
|
338
|
+
</pre>
|
339
|
+
<p>
|
340
|
+
Example
|
341
|
+
</p>
|
342
|
+
<pre>
|
343
|
+
session_pool.producer(:queue_name => 'ExampleQueue') do |session, producer|
|
344
|
+
producer.send(session.message("Hello World"))
|
345
|
+
end
|
346
|
+
</pre>
|
347
|
+
<p><a class="source-toggle" href="#"
|
348
|
+
onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
|
349
|
+
<div class="method-source-code" id="M000093-source">
|
350
|
+
<pre>
|
351
|
+
<span class="ruby-comment cmt"># File lib/jms/session_pool.rb, line 122</span>
|
352
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">producer</span>(<span class="ruby-identifier">params</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
353
|
+
<span class="ruby-identifier">session</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
354
|
+
<span class="ruby-identifier">producer</span> = <span class="ruby-keyword kw">nil</span>
|
355
|
+
<span class="ruby-keyword kw">begin</span>
|
356
|
+
<span class="ruby-identifier">producer</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">producer</span>(<span class="ruby-identifier">params</span>)
|
357
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">producer</span>)
|
358
|
+
<span class="ruby-keyword kw">ensure</span>
|
359
|
+
<span class="ruby-identifier">producer</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">producer</span>
|
360
|
+
<span class="ruby-keyword kw">end</span>
|
361
|
+
<span class="ruby-keyword kw">end</span>
|
362
|
+
<span class="ruby-keyword kw">end</span>
|
363
|
+
</pre>
|
364
|
+
</div>
|
365
|
+
</div>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div id="method-M000091" class="method-detail">
|
369
|
+
<a name="M000091"></a>
|
370
|
+
|
371
|
+
<div class="method-heading">
|
372
|
+
<a href="#M000091" class="method-signature">
|
373
|
+
<span class="method-name">session</span><span class="method-args">(&block)</span>
|
374
|
+
</a>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
<div class="method-description">
|
378
|
+
<p>
|
379
|
+
Obtain a <a href="SessionPool.html#M000091">session</a> from the pool and
|
380
|
+
pass it to the supplied block The <a
|
381
|
+
href="SessionPool.html#M000091">session</a> is automatically returned to
|
382
|
+
the pool once the block completes
|
383
|
+
</p>
|
384
|
+
<p><a class="source-toggle" href="#"
|
385
|
+
onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
|
386
|
+
<div class="method-source-code" id="M000091-source">
|
387
|
+
<pre>
|
388
|
+
<span class="ruby-comment cmt"># File lib/jms/session_pool.rb, line 57</span>
|
389
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
390
|
+
<span class="ruby-comment cmt">#TODO Check if session is open?</span>
|
391
|
+
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">with_connection</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
392
|
+
<span class="ruby-comment cmt">#TODO Catch connection failures and release from pool?</span>
|
393
|
+
<span class="ruby-keyword kw">end</span>
|
394
|
+
</pre>
|
395
|
+
</div>
|
396
|
+
</div>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
</div>
|
404
|
+
|
405
|
+
|
406
|
+
<div id="validator-badges">
|
407
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
408
|
+
</div>
|
409
|
+
|
410
|
+
</body>
|
411
|
+
</html>
|
@@ -0,0 +1,194 @@
|
|
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::TextMessage</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::TextMessage</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/jms/text_message_rb.html">
|
59
|
+
lib/jms/text_message.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
|
+
Interface javax.jms.<a href="TextMessage.html">TextMessage</a>
|
78
|
+
</p>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000064">data</a>
|
90
|
+
<a href="#M000065">data=</a>
|
91
|
+
<a href="#M000066">to_s</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000064" class="method-detail">
|
114
|
+
<a name="M000064"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000064" class="method-signature">
|
118
|
+
<span class="method-name">data</span><span class="method-args">()</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p><a class="source-toggle" href="#"
|
124
|
+
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000064-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File lib/jms/text_message.rb, line 19</span>
|
128
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data</span>
|
129
|
+
<span class="ruby-identifier">getText</span>
|
130
|
+
<span class="ruby-keyword kw">end</span>
|
131
|
+
</pre>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div id="method-M000065" class="method-detail">
|
137
|
+
<a name="M000065"></a>
|
138
|
+
|
139
|
+
<div class="method-heading">
|
140
|
+
<a href="#M000065" class="method-signature">
|
141
|
+
<span class="method-name">data=</span><span class="method-args">(val)</span>
|
142
|
+
</a>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<div class="method-description">
|
146
|
+
<p><a class="source-toggle" href="#"
|
147
|
+
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
148
|
+
<div class="method-source-code" id="M000065-source">
|
149
|
+
<pre>
|
150
|
+
<span class="ruby-comment cmt"># File lib/jms/text_message.rb, line 23</span>
|
151
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data=</span>(<span class="ruby-identifier">val</span>)
|
152
|
+
<span class="ruby-identifier">setText</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_s</span>)
|
153
|
+
<span class="ruby-keyword kw">end</span>
|
154
|
+
</pre>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div id="method-M000066" class="method-detail">
|
160
|
+
<a name="M000066"></a>
|
161
|
+
|
162
|
+
<div class="method-heading">
|
163
|
+
<a href="#M000066" class="method-signature">
|
164
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
165
|
+
</a>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div class="method-description">
|
169
|
+
<p><a class="source-toggle" href="#"
|
170
|
+
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
171
|
+
<div class="method-source-code" id="M000066-source">
|
172
|
+
<pre>
|
173
|
+
<span class="ruby-comment cmt"># File lib/jms/text_message.rb, line 27</span>
|
174
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
175
|
+
<span class="ruby-identifier">data</span>
|
176
|
+
<span class="ruby-keyword kw">end</span>
|
177
|
+
</pre>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
<div id="validator-badges">
|
190
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
</body>
|
194
|
+
</html>
|