outboxer 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,384 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Outboxer::Publisher
8
+
9
+ &mdash; Documentation by YARD 0.9.34
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Outboxer::Publisher";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (P)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Outboxer.html" title="Outboxer (module)">Outboxer</a></span></span>
41
+ &raquo;
42
+ <span class="title">Publisher</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Outboxer::Publisher
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/outboxer/publisher.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Defined Under Namespace</h2>
87
+ <p class="children">
88
+
89
+
90
+
91
+
92
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Publisher/Args.html" title="Outboxer::Publisher::Args (class)">Args</a></span>
93
+
94
+
95
+ </p>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <h2>
105
+ Class Method Summary
106
+ <small><a href="#" class="summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <ul class="summary">
110
+
111
+ <li class="public ">
112
+ <span class="summary_signature">
113
+
114
+ <a href="#publish-class_method" title="publish (class method)">.<strong>publish</strong>(poll: 1, backoff: -&gt;(current_backoff) { [current_backoff * 2, 5 * 60].min }) {|args| ... } &#x21d2; Object </a>
115
+
116
+
117
+
118
+ </span>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <span class="summary_desc"><div class='inline'>
129
+ <p>This method initiates the publishing process.</p>
130
+ </div></span>
131
+
132
+ </li>
133
+
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#stop-class_method" title="stop (class method)">.<strong>stop</strong> &#x21d2; void </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>Stops the publishing process.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ </ul>
160
+
161
+
162
+
163
+
164
+ <div id="class_method_details" class="method_details_list">
165
+ <h2>Class Method Details</h2>
166
+
167
+
168
+ <div class="method_details first">
169
+ <h3 class="signature first" id="publish-class_method">
170
+
171
+ .<strong>publish</strong>(poll: 1, backoff: -&gt;(current_backoff) { [current_backoff * 2, 5 * 60].min }) {|args| ... } &#x21d2; <tt>Object</tt>
172
+
173
+
174
+
175
+
176
+
177
+ </h3><div class="docstring">
178
+ <div class="discussion">
179
+
180
+ <p>This method initiates the publishing process. It dequeues the messages one by one and yields to a block that should contain the publishing logic.</p>
181
+
182
+
183
+ </div>
184
+ </div>
185
+ <div class="tags">
186
+ <p class="tag_title">Parameters:</p>
187
+ <ul class="param">
188
+
189
+ <li>
190
+
191
+ <span class='name'>poll</span>
192
+
193
+
194
+ <span class='type'>(<tt>Integer</tt>)</span>
195
+
196
+
197
+ <em class="default">(defaults to: <tt>1</tt>)</em>
198
+
199
+
200
+ &mdash;
201
+ <div class='inline'>
202
+ <p>Sleep time in seconds between polling the queue when it&#39;s empty.</p>
203
+ </div>
204
+
205
+ </li>
206
+
207
+ <li>
208
+
209
+ <span class='name'>backoff</span>
210
+
211
+
212
+ <span class='type'>(<tt>Proc</tt>)</span>
213
+
214
+
215
+ <em class="default">(defaults to: <tt>-&gt;(current_backoff) { [current_backoff * 2, 5 * 60].min }</tt>)</em>
216
+
217
+
218
+ &mdash;
219
+ <div class='inline'>
220
+ <p>A Proc that takes the current backoff time and returns the new backoff time.</p>
221
+ </div>
222
+
223
+ </li>
224
+
225
+ </ul>
226
+
227
+ <p class="tag_title">Yield Parameters:</p>
228
+ <ul class="yieldparam">
229
+
230
+ <li>
231
+
232
+ <span class='name'>args</span>
233
+
234
+
235
+ <span class='type'>(<tt><span class='object_link'><a href="Publisher/Args.html" title="Outboxer::Publisher::Args (class)">Args</a></span></tt>)</span>
236
+
237
+
238
+
239
+ &mdash;
240
+ <div class='inline'>
241
+ <p>An Args object containing the message to publish and a logger.</p>
242
+ </div>
243
+
244
+ </li>
245
+
246
+ </ul>
247
+
248
+ </div><table class="source_code">
249
+ <tr>
250
+ <td>
251
+ <pre class="lines">
252
+
253
+
254
+ 23
255
+ 24
256
+ 25
257
+ 26
258
+ 27
259
+ 28
260
+ 29
261
+ 30
262
+ 31
263
+ 32
264
+ 33
265
+ 34
266
+ 35
267
+ 36
268
+ 37
269
+ 38
270
+ 39
271
+ 40
272
+ 41
273
+ 42
274
+ 43
275
+ 44
276
+ 45
277
+ 46
278
+ 47
279
+ 48
280
+ 49
281
+ 50
282
+ 51
283
+ 52</pre>
284
+ </td>
285
+ <td>
286
+ <pre class="code"><span class="info file"># File 'lib/outboxer/publisher.rb', line 23</span>
287
+
288
+ <span class='kw'>def</span> <span class='id identifier rubyid_publish'>publish</span><span class='lparen'>(</span><span class='label'>poll:</span> <span class='int'>1</span><span class='comma'>,</span> <span class='label'>backoff:</span> <span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_current_backoff'>current_backoff</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='lbracket'>[</span><span class='id identifier rubyid_current_backoff'>current_backoff</span> <span class='op'>*</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>5</span> <span class='op'>*</span> <span class='int'>60</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
289
+ <span class='ivar'>@publishing</span> <span class='op'>=</span> <span class='kw'>true</span>
290
+
291
+ <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>Base</span><span class='period'>.</span><span class='id identifier rubyid_connection_pool'>connection_pool</span><span class='period'>.</span><span class='id identifier rubyid_with_connection'>with_connection</span> <span class='kw'>do</span>
292
+ <span class='kw'>while</span> <span class='ivar'>@publishing</span>
293
+ <span class='id identifier rubyid_outboxer_message'>outboxer_message</span> <span class='op'>=</span> <span class='id identifier rubyid_dequeue'>dequeue</span><span class='lparen'>(</span><span class='label'>backoff:</span> <span class='id identifier rubyid_backoff'>backoff</span><span class='rparen'>)</span>
294
+
295
+ <span class='kw'>if</span> <span class='id identifier rubyid_outboxer_message'>outboxer_message</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
296
+ <span class='id identifier rubyid_sleep'>sleep</span> <span class='id identifier rubyid_poll'>poll</span>
297
+
298
+ <span class='kw'>next</span>
299
+ <span class='kw'>end</span>
300
+
301
+ <span class='kw'>begin</span>
302
+ <span class='kw'>yield</span> <span class='const'><span class='object_link'><a href="Publisher/Args.html" title="Outboxer::Publisher::Args (class)">Args</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_outboxer_message'>outboxer_message</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='ivar'>@logger</span><span class='rparen'>)</span>
303
+ <span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_exception'>exception</span>
304
+ <span class='id identifier rubyid_failed'>failed</span><span class='lparen'>(</span>
305
+ <span class='label'>outboxer_message:</span> <span class='id identifier rubyid_outboxer_message'>outboxer_message</span><span class='comma'>,</span>
306
+ <span class='label'>backoff:</span> <span class='id identifier rubyid_backoff'>backoff</span><span class='comma'>,</span>
307
+ <span class='label'>exception:</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
308
+
309
+ <span class='kw'>next</span>
310
+ <span class='kw'>end</span>
311
+
312
+ <span class='id identifier rubyid_published'>published</span><span class='lparen'>(</span>
313
+ <span class='label'>outboxer_message:</span> <span class='id identifier rubyid_outboxer_message'>outboxer_message</span><span class='comma'>,</span>
314
+ <span class='label'>backoff:</span> <span class='id identifier rubyid_backoff'>backoff</span><span class='rparen'>)</span>
315
+ <span class='kw'>end</span>
316
+ <span class='kw'>end</span>
317
+ <span class='kw'>end</span></pre>
318
+ </td>
319
+ </tr>
320
+ </table>
321
+ </div>
322
+
323
+ <div class="method_details ">
324
+ <h3 class="signature " id="stop-class_method">
325
+
326
+ .<strong>stop</strong> &#x21d2; <tt>void</tt>
327
+
328
+
329
+
330
+
331
+
332
+ </h3><div class="docstring">
333
+ <div class="discussion">
334
+
335
+ <div class="note notetag">
336
+ <strong>Note:</strong>
337
+ <div class='inline'>
338
+ <p>This method will stop the current message publishing process It is a safe way to interrupt the publishing process at any point.</p>
339
+ </div>
340
+ </div>
341
+
342
+ <p class="note returns_void">This method returns an undefined value.</p>
343
+ <p>Stops the publishing process.</p>
344
+
345
+
346
+ </div>
347
+ </div>
348
+ <div class="tags">
349
+
350
+
351
+ </div><table class="source_code">
352
+ <tr>
353
+ <td>
354
+ <pre class="lines">
355
+
356
+
357
+ 120
358
+ 121
359
+ 122</pre>
360
+ </td>
361
+ <td>
362
+ <pre class="code"><span class="info file"># File 'lib/outboxer/publisher.rb', line 120</span>
363
+
364
+ <span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span>
365
+ <span class='ivar'>@publishing</span> <span class='op'>=</span> <span class='kw'>false</span>
366
+ <span class='kw'>end</span></pre>
367
+ </td>
368
+ </tr>
369
+ </table>
370
+ </div>
371
+
372
+ </div>
373
+
374
+ </div>
375
+
376
+ <div id="footer">
377
+ Generated on Sat Aug 5 04:37:46 2023 by
378
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
379
+ 0.9.34 (ruby-2.7.8).
380
+ </div>
381
+
382
+ </div>
383
+ </body>
384
+ </html>
@@ -0,0 +1,124 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Outboxer::Railtie
8
+
9
+ &mdash; Documentation by YARD 0.9.34
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Outboxer::Railtie";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (R)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Outboxer.html" title="Outboxer (module)">Outboxer</a></span></span>
41
+ &raquo;
42
+ <span class="title">Railtie</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Outboxer::Railtie
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Rails::Railtie</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Rails::Railtie</li>
78
+
79
+ <li class="next">Outboxer::Railtie</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/outboxer/railtie.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ </div>
115
+
116
+ <div id="footer">
117
+ Generated on Sat Aug 5 04:37:46 2023 by
118
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
+ 0.9.34 (ruby-2.7.8).
120
+ </div>
121
+
122
+ </div>
123
+ </body>
124
+ </html>
data/doc/Outboxer.html ADDED
@@ -0,0 +1,150 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Outboxer
8
+
9
+ &mdash; Documentation by YARD 0.9.34
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Outboxer";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (O)</a> &raquo;
40
+
41
+
42
+ <span class="title">Outboxer</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Outboxer
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/outboxer.rb<span class="defines">,<br />
82
+ lib/outboxer/railtie.rb,<br /> lib/outboxer/version.rb,<br /> lib/outboxer/publisher.rb,<br /> lib/outboxer/models/message.rb,<br /> lib/outboxer/models/exception.rb,<br /> lib/outboxer/models/outboxable.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Defined Under Namespace</h2>
89
+ <p class="children">
90
+
91
+
92
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Outboxer/Models.html" title="Outboxer::Models (module)">Models</a></span>, <span class='object_link'><a href="Outboxer/Publisher.html" title="Outboxer::Publisher (module)">Publisher</a></span>
93
+
94
+
95
+
96
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Outboxer/Railtie.html" title="Outboxer::Railtie (class)">Railtie</a></span>
97
+
98
+
99
+ </p>
100
+
101
+
102
+ <h2>
103
+ Constant Summary
104
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
105
+ </h2>
106
+
107
+ <dl class="constants">
108
+
109
+ <dt id="Outboxable-constant" class="">Outboxable =
110
+
111
+ </dt>
112
+ <dd><pre class="code"><span class='const'><span class='object_link'><a href="Outboxer/Models.html" title="Outboxer::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Outboxer/Models/Outboxable.html" title="Outboxer::Models::Outboxable (module)">Outboxable</a></span></span></pre></dd>
113
+
114
+ <dt id="Message-constant" class="">Message =
115
+
116
+ </dt>
117
+ <dd><pre class="code"><span class='const'><span class='object_link'><a href="Outboxer/Models.html" title="Outboxer::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Outboxer/Models/Message.html" title="Outboxer::Models::Message (class)">Message</a></span></span></pre></dd>
118
+
119
+ <dt id="Exception-constant" class="">Exception =
120
+
121
+ </dt>
122
+ <dd><pre class="code"><span class='const'><span class='object_link'><a href="Outboxer/Models.html" title="Outboxer::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Outboxer/Models/Exception.html" title="Outboxer::Models::Exception (class)">Exception</a></span></span></pre></dd>
123
+
124
+ <dt id="VERSION-constant" class="">VERSION =
125
+
126
+ </dt>
127
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.1</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
128
+
129
+ </dl>
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ </div>
141
+
142
+ <div id="footer">
143
+ Generated on Sat Aug 5 04:37:46 2023 by
144
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
145
+ 0.9.34 (ruby-2.7.8).
146
+ </div>
147
+
148
+ </div>
149
+ </body>
150
+ </html>