-
Notifications
You must be signed in to change notification settings - Fork 0
/
Client.html
486 lines (483 loc) · 42.8 KB
/
Client.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<title>: Stomp::Client [Stomp]</title>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
//<![CDATA[
function popupCode(url) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode(id) {
var code = document.getElementById(id)
code.style.display = code.style.display != 'block' ? 'block' : 'none'
return true
}
// Make codeblocks hidden by default
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
//]]>
</script>
</head>
<body class='page'>
<div class='class' id='wrapper'>
<div class='header'>
<h1 class='name'>
<span class='type'>Class</span>
Stomp::Client
</h1>
<ol class='paths'>
<li>
<a href="../../files/lib/stomp/client_rb.html">lib/stomp/client.rb</a>
</li>
</ol>
<div class='parent'>
Parent:
<strong>Object</strong>
</div>
</div>
<div id='content'>
<div id='text'>
<div id='description'>
<p>
Typical <a href="../Stomp.html">Stomp</a> client class. Uses a listener
thread to receive frames from the server, any thread can send.
</p>
<p>
Receives all happen in one thread, so consider not doing much processing in
that thread if you have much message volume.
</p>
</div>
<div id='method-list'>
<h2>Methods</h2>
<h3>public class</h3>
<ol>
<li><a href="#M000011">new</a></li>
<li><a href="#M000012">open</a></li>
</ol>
<h3>public instance</h3>
<ol>
<li><a href="#M000015">abort</a></li>
<li><a href="#M000019">acknowledge</a></li>
<li><a href="#M000014">begin</a></li>
<li><a href="#M000028">close</a></li>
<li><a href="#M000027">closed?</a></li>
<li><a href="#M000016">commit</a></li>
<li><a href="#M000024">connection_frame</a></li>
<li><a href="#M000025">disconnect_receipt</a></li>
<li><a href="#M000013">join</a></li>
<li><a href="#M000022">obj_send</a></li>
<li><a href="#M000026">open?</a></li>
<li><a href="#M000021">publish</a></li>
<li><a href="#M000029">running</a></li>
<li><a href="#M000023">send</a></li>
<li><a href="#M000017">subscribe</a></li>
<li><a href="#M000020">unreceive</a></li>
<li><a href="#M000018">unsubscribe</a></li>
</ol>
</div>
<div id='section'>
<div id='attribute-list'>
<h2 class='section-bar'>Attributes</h2>
<div class='name-list'>
<table>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>host</td>
<td class='context-item-value'>[R]</td>
<td class='context-item-desc'></td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>login</td>
<td class='context-item-value'>[R]</td>
<td class='context-item-desc'></td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>parameters</td>
<td class='context-item-value'>[R]</td>
<td class='context-item-desc'></td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>passcode</td>
<td class='context-item-value'>[R]</td>
<td class='context-item-desc'></td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>port</td>
<td class='context-item-value'>[R]</td>
<td class='context-item-desc'></td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>reliable</td>
<td class='context-item-value'>[R]</td>
<td class='context-item-desc'></td>
</tr>
</table>
</div>
</div>
<div id='methods'>
<h2>Public class methods</h2>
<div class='method public-class' id='method-M000011'>
<a name='M000011'></a>
<div class='synopsis'>
<span class='name'>new</span>
<span class='arguments'>(login = '', passcode = '', host = 'localhost', port = 61613, reliable = false)</span>
</div>
<div class='description'>
<p>
A new <a href="Client.html">Client</a> object can be initialized using two
forms:
</p>
<p>
Standard positional parameters:
</p>
<pre>login (String, default : '')
passcode (String, default : '')
host (String, default : 'localhost')
port (Integer, default : 61613)
reliable (Boolean, default : false)

e.g. c = Client.new('login', 'passcode', 'localhost', 61613, true)</pre>
<p>
<a href="../Stomp.html">Stomp</a> URL :
</p>
<pre>A Stomp URL must begin with 'stomp://' and can be in one of the following forms:

stomp://host:port
stomp://host.domain.tld:port
stomp://login:passcode@host:port
stomp://login:passcode@host.domain.tld:port</pre>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
[show source]
</a>
<pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 35</span>
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">login</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">passcode</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">host</span> = <span class="ruby-value str">'localhost'</span>, <span class="ruby-identifier">port</span> = <span class="ruby-value">61613</span>, <span class="ruby-identifier">reliable</span> = <span class="ruby-keyword kw">false</span>)
36: 
37: <span class="ruby-comment cmt"># Parse stomp:// URL's or set params</span>
38: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">login</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
39: <span class="ruby-ivar">@parameters</span> = <span class="ruby-identifier">login</span>
40: 
41: <span class="ruby-identifier">first_host</span> = <span class="ruby-ivar">@parameters</span>[<span class="ruby-identifier">:hosts</span>][<span class="ruby-value">0</span>]
42: 
43: <span class="ruby-ivar">@login</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:login</span>]
44: <span class="ruby-ivar">@passcode</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:passcode</span>]
45: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:host</span>]
46: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:port</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Connection</span><span class="ruby-operator">::</span><span class="ruby-identifier">default_port</span>(<span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:ssl</span>])
47: 
48: <span class="ruby-ivar">@reliable</span> = <span class="ruby-keyword kw">true</span>
49: 
50: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">login</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^stomp:\/\/(([\w\.]+):(\w+)@)?([\w\.]+):(\d+)/</span> <span class="ruby-comment cmt"># e.g. stomp://login:passcode@host:port or stomp://host:port</span>
51: <span class="ruby-ivar">@login</span> = <span class="ruby-identifier">$2</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
52: <span class="ruby-ivar">@passcode</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
53: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">$4</span>
54: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">$5</span>.<span class="ruby-identifier">to_i</span>
55: <span class="ruby-ivar">@reliable</span> = <span class="ruby-keyword kw">false</span>
56: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">login</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^failover:(\/\/)?\(stomp(\+ssl)?:\/\/(([\w\.]*):(\w*)@)?([\w\.]+):(\d+)(,stomp(\+ssl)?:\/\/(([\w\.]*):(\w*)@)?([\w\.]+):(\d+)\))+(\?(.*))?$/</span> <span class="ruby-comment cmt"># e.g. failover://(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)?option1=param</span>
57: 
58: <span class="ruby-identifier">first_host</span> = {}
59: <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:ssl</span>] = <span class="ruby-operator">!</span><span class="ruby-identifier">$2</span>.<span class="ruby-identifier">nil?</span>
60: <span class="ruby-ivar">@login</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:login</span>] = <span class="ruby-identifier">$4</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
61: <span class="ruby-ivar">@passcode</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:passcode</span>] = <span class="ruby-identifier">$5</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
62: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:host</span>] = <span class="ruby-identifier">$6</span>
63: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:port</span>] = <span class="ruby-identifier">$7</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Connection</span><span class="ruby-operator">::</span><span class="ruby-identifier">default_port</span>(<span class="ruby-identifier">first_host</span>[<span class="ruby-identifier">:ssl</span>])
64: 
65: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">$16</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
66: <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/&|=/</span>)
67: <span class="ruby-identifier">options</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">parts</span>]
68: 
69: <span class="ruby-identifier">hosts</span> = [<span class="ruby-identifier">first_host</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">parse_hosts</span>(<span class="ruby-identifier">login</span>)
70: 
71: <span class="ruby-ivar">@parameters</span> = {}
72: <span class="ruby-ivar">@parameters</span>[<span class="ruby-identifier">:hosts</span>] = <span class="ruby-identifier">hosts</span>
73: 
74: <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">filter_options</span>(<span class="ruby-identifier">options</span>)
75: 
76: <span class="ruby-ivar">@reliable</span> = <span class="ruby-keyword kw">true</span>
77: <span class="ruby-keyword kw">else</span>
78: <span class="ruby-ivar">@login</span> = <span class="ruby-identifier">login</span>
79: <span class="ruby-ivar">@passcode</span> = <span class="ruby-identifier">passcode</span>
80: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
81: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_i</span>
82: <span class="ruby-ivar">@reliable</span> = <span class="ruby-identifier">reliable</span>
83: <span class="ruby-keyword kw">end</span>
84: 
85: <span class="ruby-identifier">check_arguments!</span>
86: 
87: <span class="ruby-ivar">@id_mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
88: <span class="ruby-ivar">@ids</span> = <span class="ruby-value">1</span>
89: 
90: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parameters</span>
91: <span class="ruby-ivar">@connection</span> = <span class="ruby-constant">Connection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@parameters</span>)
92: <span class="ruby-keyword kw">else</span>
93: <span class="ruby-ivar">@connection</span> = <span class="ruby-constant">Connection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@login</span>, <span class="ruby-ivar">@passcode</span>, <span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@port</span>, <span class="ruby-ivar">@reliable</span>)
94: <span class="ruby-keyword kw">end</span>
95: 
96: <span class="ruby-identifier">start_listeners</span>
97: 
98: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-class' id='method-M000012'>
<a name='M000012'></a>
<div class='synopsis'>
<span class='name'>open</span>
<span class='arguments'>(login = '', passcode = '', host = 'localhost', port = 61613, reliable = false)</span>
</div>
<div class='description'>
<p>
Syntactic sugar for ‘<a
href="Client.html#M000011">Client.new</a>’ See
‘initialize’ for usage.
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
[show source]
</a>
<pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 101</span>
101: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">login</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">passcode</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">host</span> = <span class="ruby-value str">'localhost'</span>, <span class="ruby-identifier">port</span> = <span class="ruby-value">61613</span>, <span class="ruby-identifier">reliable</span> = <span class="ruby-keyword kw">false</span>)
102: <span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">login</span>, <span class="ruby-identifier">passcode</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">reliable</span>)
103: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<h2>Public instance methods</h2>
<div class='method public-instance' id='method-M000015'>
<a name='M000015'></a>
<div class='synopsis'>
<span class='name'>abort</span>
<span class='arguments'>(name, headers = {})</span>
</div>
<div class='description'>
<p>
Abort a transaction by name
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
[show source]
</a>
<pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 117</span>
117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abort</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span> = {})
118: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">abort</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span>)
119: 
120: <span class="ruby-comment cmt"># lets replay any ack'd messages in this transaction</span>
121: <span class="ruby-identifier">replay_list</span> = <span class="ruby-ivar">@replay_messages_by_txn</span>[<span class="ruby-identifier">name</span>]
122: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replay_list</span>
123: <span class="ruby-identifier">replay_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">message</span><span class="ruby-operator">|</span>
124: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">listener</span> = <span class="ruby-ivar">@listeners</span>[<span class="ruby-identifier">message</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'destination'</span>]]
125: <span class="ruby-identifier">listener</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">message</span>)
126: <span class="ruby-keyword kw">end</span>
127: <span class="ruby-keyword kw">end</span>
128: <span class="ruby-keyword kw">end</span>
129: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000019'>
<a name='M000019'></a>
<div class='synopsis'>
<span class='name'>acknowledge</span>
<span class='arguments'>(message, headers = {}) {|r| ...}</span>
</div>
<div class='description'>
<p>
Acknowledge a message, used when a subscription has specified client
acknowledgement ( connection.subscribe “/queue/a“, :ack =>
‘client’g
</p>
<p>
Accepts a transaction header ( :transaction =>
‘some_transaction_id’ )
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
[show source]
</a>
<pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 158</span>
158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acknowledge</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">headers</span> = {})
159: <span class="ruby-identifier">txn_id</span> = <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">:transaction</span>]
160: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">txn_id</span>
161: <span class="ruby-comment cmt"># lets keep around messages ack'd in this transaction in case we rollback</span>
162: <span class="ruby-identifier">replay_list</span> = <span class="ruby-ivar">@replay_messages_by_txn</span>[<span class="ruby-identifier">txn_id</span>]
163: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replay_list</span>.<span class="ruby-identifier">nil?</span>
164: <span class="ruby-identifier">replay_list</span> = []
165: <span class="ruby-ivar">@replay_messages_by_txn</span>[<span class="ruby-identifier">txn_id</span>] = <span class="ruby-identifier">replay_list</span>
166: <span class="ruby-keyword kw">end</span>
167: <span class="ruby-identifier">replay_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">message</span>
168: <span class="ruby-keyword kw">end</span>
169: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
170: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'receipt'</span>] = <span class="ruby-identifier">register_receipt_listener</span> <span class="ruby-identifier">lambda</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">r</span>}
171: <span class="ruby-keyword kw">end</span>
172: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">ack</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'message-id'</span>], <span class="ruby-identifier">headers</span>
173: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000014'>
<a name='M000014'></a>
<div class='synopsis'>
<span class='name'>begin</span>
<span class='arguments'>(name, headers = {})</span>
</div>
<div class='description'>
<p>
Begin a transaction by name
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
[show source]
</a>
<pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 112</span>
112: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">begin</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span> = {})
113: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span>)
114: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000028'>
<a name='M000028'></a>
<div class='synopsis'>
<span class='name'>close</span>
<span class='arguments'>(headers={})</span>
</div>
<div class='description'>
<p>
Close out resources in use by this client
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
[show source]
</a>
<pre id='M000028-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 222</span>
222: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span> <span class="ruby-identifier">headers</span>={}
223: <span class="ruby-ivar">@listener_thread</span>.<span class="ruby-identifier">exit</span>
224: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">disconnect</span> <span class="ruby-identifier">headers</span>
225: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000027'>
<a name='M000027'></a>
<div class='synopsis'>
<span class='name'>closed?</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Is this client closed?
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
[show source]
</a>
<pre id='M000027-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 217</span>
217: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">closed?</span>
218: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">closed?</span>
219: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000016'>
<a name='M000016'></a>
<div class='synopsis'>
<span class='name'>commit</span>
<span class='arguments'>(name, headers = {})</span>
</div>
<div class='description'>
<p>
Commit a transaction by name
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
[show source]
</a>
<pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 132</span>
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commit</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span> = {})
133: <span class="ruby-identifier">txn_id</span> = <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">:transaction</span>]
134: <span class="ruby-ivar">@replay_messages_by_txn</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">txn_id</span>)
135: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span>)
136: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000024'>
<a name='M000024'></a>
<div class='synopsis'>
<span class='name'>connection_frame</span>
<span class='arguments'>()</span>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
[show source]
</a>
<pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 203</span>
203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connection_frame</span>
204: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">connection_frame</span>
205: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000025'>
<a name='M000025'></a>
<div class='synopsis'>
<span class='name'>disconnect_receipt</span>
<span class='arguments'>()</span>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
[show source]
</a>
<pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 207</span>
207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">disconnect_receipt</span>
208: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">disconnect_receipt</span>
209: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000013'>
<a name='M000013'></a>
<div class='synopsis'>
<span class='name'>join</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Join the listener thread for this client, generally used to wait for a quit
signal
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
[show source]
</a>
<pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 107</span>
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>
108: <span class="ruby-ivar">@listener_thread</span>.<span class="ruby-identifier">join</span>
109: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000022'>
<a name='M000022'></a>
<div class='synopsis'>
<span class='name'>obj_send</span>
<span class='arguments'>(*args)</span>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
[show source]
</a>
<pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 194</span>
194: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">obj_send</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
195: <span class="ruby-identifier">__send__</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
196: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000026'>
<a name='M000026'></a>
<div class='synopsis'>
<span class='name'>open?</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Is this client open?
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
[show source]
</a>
<pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 212</span>
212: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open?</span>
213: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">open?</span>
214: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000021'>
<a name='M000021'></a>
<div class='synopsis'>
<span class='name'>publish</span>
<span class='arguments'>(destination, message, headers = {}) {|r| ...}</span>
</div>
<div class='description'>
<p>
Publishes message to destination
</p>
<p>
If a block is given a receipt will be requested and passed to the block on
receipt
</p>
<p>
Accepts a transaction header ( :transaction =>
‘some_transaction_id’ )
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
[show source]
</a>
<pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 187</span>
187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">publish</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">headers</span> = {})
188: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
189: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'receipt'</span>] = <span class="ruby-identifier">register_receipt_listener</span> <span class="ruby-identifier">lambda</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">r</span>}
190: <span class="ruby-keyword kw">end</span>
191: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">publish</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">headers</span>)
192: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000029'>
<a name='M000029'></a>
<div class='synopsis'>
<span class='name'>running</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Check if the thread was created and isn’t dead
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
[show source]
</a>
<pre id='M000029-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 228</span>
228: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">running</span>
229: <span class="ruby-ivar">@listener_thread</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-ivar">@listener_thread</span>.<span class="ruby-identifier">status</span>
230: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000023'>
<a name='M000023'></a>
<div class='synopsis'>
<span class='name'>send</span>
<span class='arguments'>(*args)</span>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
[show source]
</a>
<pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 198</span>
198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
199: <span class="ruby-identifier">warn</span>(<span class="ruby-value str">"This method is deprecated and will be removed on the next release. Use 'publish' instead"</span>)
200: <span class="ruby-identifier">publish</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
201: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000017'>
<a name='M000017'></a>
<div class='synopsis'>
<span class='name'>subscribe</span>
<span class='arguments'>(destination, headers = {}) {|msg| ...}</span>
</div>
<div class='description'>
<p>
Subscribe to a destination, must be passed a block which will be used as a
callback listener
</p>
<p>
Accepts a transaction header ( :transaction =>
‘some_transaction_id’ )
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
[show source]
</a>
<pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 142</span>
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subscribe</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">headers</span> = {})
143: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"No listener given"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
144: <span class="ruby-ivar">@listeners</span>[<span class="ruby-identifier">destination</span>] = <span class="ruby-identifier">lambda</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">msg</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">msg</span>}
145: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">subscribe</span>(<span class="ruby-identifier">destination</span>, <span class="ruby-identifier">headers</span>)
146: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000020'>
<a name='M000020'></a>
<div class='synopsis'>
<span class='name'>unreceive</span>
<span class='arguments'>(message, options = {})</span>
</div>
<div class='description'>
<p>
Unreceive a message, sending it back to its queue or to the DLQ
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
[show source]
</a>
<pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 177</span>
177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unreceive</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span> = {})
178: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">unreceive</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>)
179: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000018'>
<a name='M000018'></a>
<div class='synopsis'>
<span class='name'>unsubscribe</span>
<span class='arguments'>(name, headers = {})</span>
</div>
<div class='description'>
<p>
Unsubecribe from a channel
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
[show source]
</a>
<pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/stomp/client.rb, line 149</span>
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unsubscribe</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span> = {})
150: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">unsubscribe</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">headers</span>)
151: <span class="ruby-ivar">@listeners</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-keyword kw">nil</span>
152: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div id='footer-push'></div>
</div>
<div id='footer'>
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
</div>
</body>
</html>