servus 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/.yardopts +6 -0
- data/CHANGELOG.md +7 -0
- data/IDEAS.md +5 -0
- data/READme.md +147 -42
- data/Rakefile +33 -0
- data/builds/servus-0.1.3.gem +0 -0
- data/builds/servus-0.1.4.gem +0 -0
- data/docs/core/1_overview.md +77 -0
- data/docs/core/2_architecture.md +92 -0
- data/docs/core/3_service_objects.md +121 -0
- data/docs/features/1_schema_validation.md +119 -0
- data/docs/features/2_error_handling.md +121 -0
- data/docs/features/3_async_execution.md +81 -0
- data/docs/features/4_logging.md +64 -0
- data/docs/guides/1_common_patterns.md +90 -0
- data/docs/guides/2_migration_guide.md +175 -0
- data/docs/integration/1_configuration.md +51 -0
- data/docs/integration/2_testing.md +164 -0
- data/docs/integration/3_rails_integration.md +99 -0
- data/docs/yard/Servus/Base.html +1645 -0
- data/docs/yard/Servus/Config.html +582 -0
- data/docs/yard/Servus/Extensions/Async/Call.html +400 -0
- data/docs/yard/Servus/Extensions/Async/Errors/AsyncError.html +140 -0
- data/docs/yard/Servus/Extensions/Async/Errors/JobEnqueueError.html +154 -0
- data/docs/yard/Servus/Extensions/Async/Errors/ServiceNotFoundError.html +154 -0
- data/docs/yard/Servus/Extensions/Async/Errors.html +128 -0
- data/docs/yard/Servus/Extensions/Async/Ext.html +119 -0
- data/docs/yard/Servus/Extensions/Async/Job.html +310 -0
- data/docs/yard/Servus/Extensions/Async.html +141 -0
- data/docs/yard/Servus/Extensions.html +117 -0
- data/docs/yard/Servus/Generators/ServiceGenerator.html +261 -0
- data/docs/yard/Servus/Generators.html +115 -0
- data/docs/yard/Servus/Helpers/ControllerHelpers.html +457 -0
- data/docs/yard/Servus/Helpers.html +115 -0
- data/docs/yard/Servus/Railtie.html +134 -0
- data/docs/yard/Servus/Support/Errors/AuthenticationError.html +287 -0
- data/docs/yard/Servus/Support/Errors/BadRequestError.html +283 -0
- data/docs/yard/Servus/Support/Errors/ForbiddenError.html +284 -0
- data/docs/yard/Servus/Support/Errors/InternalServerError.html +283 -0
- data/docs/yard/Servus/Support/Errors/NotFoundError.html +284 -0
- data/docs/yard/Servus/Support/Errors/ServiceError.html +489 -0
- data/docs/yard/Servus/Support/Errors/ServiceUnavailableError.html +290 -0
- data/docs/yard/Servus/Support/Errors/UnauthorizedError.html +200 -0
- data/docs/yard/Servus/Support/Errors/UnprocessableEntityError.html +288 -0
- data/docs/yard/Servus/Support/Errors/ValidationError.html +200 -0
- data/docs/yard/Servus/Support/Errors.html +140 -0
- data/docs/yard/Servus/Support/Logger.html +856 -0
- data/docs/yard/Servus/Support/Rescuer/BlockContext.html +585 -0
- data/docs/yard/Servus/Support/Rescuer/CallOverride.html +257 -0
- data/docs/yard/Servus/Support/Rescuer/ClassMethods.html +343 -0
- data/docs/yard/Servus/Support/Rescuer.html +267 -0
- data/docs/yard/Servus/Support/Response.html +574 -0
- data/docs/yard/Servus/Support/Validator.html +1150 -0
- data/docs/yard/Servus/Support.html +119 -0
- data/docs/yard/Servus/Testing/ExampleBuilders.html +523 -0
- data/docs/yard/Servus/Testing/ExampleExtractor.html +578 -0
- data/docs/yard/Servus/Testing.html +142 -0
- data/docs/yard/Servus.html +343 -0
- data/docs/yard/_index.html +535 -0
- data/docs/yard/class_list.html +54 -0
- data/docs/yard/css/common.css +1 -0
- data/docs/yard/css/full_list.css +58 -0
- data/docs/yard/css/style.css +503 -0
- data/docs/yard/file.1_common_patterns.html +154 -0
- data/docs/yard/file.1_configuration.html +115 -0
- data/docs/yard/file.1_overview.html +142 -0
- data/docs/yard/file.1_schema_validation.html +188 -0
- data/docs/yard/file.2_architecture.html +157 -0
- data/docs/yard/file.2_error_handling.html +190 -0
- data/docs/yard/file.2_migration_guide.html +242 -0
- data/docs/yard/file.2_testing.html +227 -0
- data/docs/yard/file.3_async_execution.html +145 -0
- data/docs/yard/file.3_rails_integration.html +160 -0
- data/docs/yard/file.3_service_objects.html +191 -0
- data/docs/yard/file.4_logging.html +135 -0
- data/docs/yard/file.ErrorHandling.html +190 -0
- data/docs/yard/file.READme.html +674 -0
- data/docs/yard/file.architecture.html +157 -0
- data/docs/yard/file.async_execution.html +145 -0
- data/docs/yard/file.common_patterns.html +154 -0
- data/docs/yard/file.configuration.html +115 -0
- data/docs/yard/file.error_handling.html +190 -0
- data/docs/yard/file.logging.html +135 -0
- data/docs/yard/file.migration_guide.html +242 -0
- data/docs/yard/file.overview.html +142 -0
- data/docs/yard/file.rails_integration.html +160 -0
- data/docs/yard/file.schema_validation.html +188 -0
- data/docs/yard/file.service_objects.html +191 -0
- data/docs/yard/file.testing.html +227 -0
- data/docs/yard/file_list.html +119 -0
- data/docs/yard/frames.html +22 -0
- data/docs/yard/index.html +674 -0
- data/docs/yard/js/app.js +344 -0
- data/docs/yard/js/full_list.js +242 -0
- data/docs/yard/js/jquery.js +4 -0
- data/docs/yard/method_list.html +542 -0
- data/docs/yard/top-level-namespace.html +110 -0
- data/lib/generators/servus/service/service_generator.rb +64 -1
- data/lib/generators/servus/service/templates/service.rb.erb +1 -1
- data/lib/servus/base.rb +258 -57
- data/lib/servus/config.rb +58 -12
- data/lib/servus/extensions/async/call.rb +50 -18
- data/lib/servus/extensions/async/errors.rb +23 -3
- data/lib/servus/extensions/async/ext.rb +10 -2
- data/lib/servus/extensions/async/job.rb +30 -9
- data/lib/servus/helpers/controller_helpers.rb +73 -37
- data/lib/servus/support/errors.rb +135 -45
- data/lib/servus/support/rescuer.rb +189 -36
- data/lib/servus/support/response.rb +49 -7
- data/lib/servus/support/validator.rb +120 -19
- data/lib/servus/testing/example_builders.rb +133 -0
- data/lib/servus/testing/example_extractor.rb +309 -0
- data/lib/servus/testing.rb +17 -0
- data/lib/servus/version.rb +1 -1
- metadata +117 -19
|
@@ -0,0 +1,400 @@
|
|
|
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: Servus::Extensions::Async::Call
|
|
8
|
+
|
|
9
|
+
— Servus | Service Object Framework
|
|
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 = "Servus::Extensions::Async::Call";
|
|
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 (C)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../Servus.html" title="Servus (module)">Servus</a></span></span> » <span class='title'><span class='object_link'><a href="../../Extensions.html" title="Servus::Extensions (module)">Extensions</a></span></span> » <span class='title'><span class='object_link'><a href="../Async.html" title="Servus::Extensions::Async (module)">Async</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">Call</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: Servus::Extensions::Async::Call
|
|
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/servus/extensions/async/call.rb</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
|
87
|
+
<div class="discussion">
|
|
88
|
+
<p>Provides asynchronous service execution via ActiveJob.</p>
|
|
89
|
+
|
|
90
|
+
<p>This module extends <span class='object_link'><a href="../../Base.html" title="Servus::Base (class)">Base</a></span> with the <span class='object_link'><a href="#call_async-instance_method" title="Servus::Extensions::Async::Call#call_async (method)">#call_async</a></span> method, enabling
|
|
91
|
+
services to be executed in background jobs. Requires ActiveJob to be loaded.</p>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="tags">
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<p class="tag_title">See Also:</p>
|
|
100
|
+
<ul class="see">
|
|
101
|
+
|
|
102
|
+
<li><span class='object_link'><a href="#call_async-instance_method" title="Servus::Extensions::Async::Call#call_async (method)">#call_async</a></span></li>
|
|
103
|
+
|
|
104
|
+
</ul>
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
<h2>
|
|
115
|
+
Instance Method Summary
|
|
116
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
117
|
+
</h2>
|
|
118
|
+
|
|
119
|
+
<ul class="summary">
|
|
120
|
+
|
|
121
|
+
<li class="public ">
|
|
122
|
+
<span class="summary_signature">
|
|
123
|
+
|
|
124
|
+
<a href="#call_async-instance_method" title="#call_async (instance method)">#<strong>call_async</strong>(**args) ⇒ void </a>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
</span>
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
<span class="summary_desc"><div class='inline'><p>Enqueues the service for asynchronous execution via ActiveJob.</p>
|
|
139
|
+
</div></span>
|
|
140
|
+
|
|
141
|
+
</li>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
</ul>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
<div id="instance_method_details" class="method_details_list">
|
|
150
|
+
<h2>Instance Method Details</h2>
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
<div class="method_details first">
|
|
154
|
+
<h3 class="signature first" id="call_async-instance_method">
|
|
155
|
+
|
|
156
|
+
#<strong>call_async</strong>(**args) ⇒ <tt>void</tt>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
</h3><div class="docstring">
|
|
163
|
+
<div class="discussion">
|
|
164
|
+
|
|
165
|
+
<div class="note notetag">
|
|
166
|
+
<strong>Note:</strong>
|
|
167
|
+
<div class='inline'><p>Only available when ActiveJob is loaded (typically in Rails applications)</p>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<p class="note returns_void">This method returns an undefined value.</p><p>Enqueues the service for asynchronous execution via ActiveJob.</p>
|
|
172
|
+
|
|
173
|
+
<p>This method schedules the service to run in a background job, supporting
|
|
174
|
+
all standard ActiveJob options for scheduling, queue routing, and priority.</p>
|
|
175
|
+
|
|
176
|
+
<p>Service arguments are passed as keyword arguments alongside job configuration.
|
|
177
|
+
Job-specific options are extracted and the remaining arguments are passed
|
|
178
|
+
to the service's initialize method.</p>
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
<div class="tags">
|
|
184
|
+
|
|
185
|
+
<div class="examples">
|
|
186
|
+
<h4 class="tag_title">Examples:</h4>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
<h5 class="example_title"><div class='inline'><p>Basic async execution</p>
|
|
190
|
+
</div></h5>
|
|
191
|
+
|
|
192
|
+
<pre class="example code"><code><span class='const'>Services</span><span class='op'>::</span><span class='const'>SendEmail</span><span class='op'>::</span><span class='const'>Service</span><span class='period'>.</span><span class='id identifier rubyid_call_async'>call_async</span><span class='lparen'>(</span>
|
|
193
|
+
<span class='label'>user_id:</span> <span class='int'>123</span><span class='comma'>,</span>
|
|
194
|
+
<span class='label'>template:</span> <span class='symbol'>:welcome</span>
|
|
195
|
+
<span class='rparen'>)</span></code></pre>
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
<h5 class="example_title"><div class='inline'><p>With delay</p>
|
|
199
|
+
</div></h5>
|
|
200
|
+
|
|
201
|
+
<pre class="example code"><code><span class='const'>Services</span><span class='op'>::</span><span class='const'>SendReminder</span><span class='op'>::</span><span class='const'>Service</span><span class='period'>.</span><span class='id identifier rubyid_call_async'>call_async</span><span class='lparen'>(</span>
|
|
202
|
+
<span class='label'>wait:</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_day'>day</span><span class='comma'>,</span>
|
|
203
|
+
<span class='label'>user_id:</span> <span class='int'>123</span>
|
|
204
|
+
<span class='rparen'>)</span></code></pre>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<h5 class="example_title"><div class='inline'><p>With queue and priority</p>
|
|
208
|
+
</div></h5>
|
|
209
|
+
|
|
210
|
+
<pre class="example code"><code><span class='const'>Services</span><span class='op'>::</span><span class='const'>ProcessPayment</span><span class='op'>::</span><span class='const'>Service</span><span class='period'>.</span><span class='id identifier rubyid_call_async'>call_async</span><span class='lparen'>(</span>
|
|
211
|
+
<span class='label'>queue:</span> <span class='symbol'>:critical</span><span class='comma'>,</span>
|
|
212
|
+
<span class='label'>priority:</span> <span class='int'>10</span><span class='comma'>,</span>
|
|
213
|
+
<span class='label'>order_id:</span> <span class='int'>456</span>
|
|
214
|
+
<span class='rparen'>)</span></code></pre>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
<h5 class="example_title"><div class='inline'><p>With custom job options</p>
|
|
218
|
+
</div></h5>
|
|
219
|
+
|
|
220
|
+
<pre class="example code"><code><span class='const'>Services</span><span class='op'>::</span><span class='const'>GenerateReport</span><span class='op'>::</span><span class='const'>Service</span><span class='period'>.</span><span class='id identifier rubyid_call_async'>call_async</span><span class='lparen'>(</span>
|
|
221
|
+
<span class='label'>wait_until:</span> <span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_tomorrow'>tomorrow</span><span class='period'>.</span><span class='id identifier rubyid_beginning_of_day'>beginning_of_day</span><span class='comma'>,</span>
|
|
222
|
+
<span class='label'>job_options:</span> <span class='lbrace'>{</span> <span class='label'>tags:</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>reports</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>daily</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
223
|
+
<span class='label'>report_type:</span> <span class='symbol'>:sales</span>
|
|
224
|
+
<span class='rparen'>)</span></code></pre>
|
|
225
|
+
|
|
226
|
+
</div>
|
|
227
|
+
<p class="tag_title">Parameters:</p>
|
|
228
|
+
<ul class="param">
|
|
229
|
+
|
|
230
|
+
<li>
|
|
231
|
+
|
|
232
|
+
<span class='name'>args</span>
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
—
|
|
240
|
+
<div class='inline'><p>combined service arguments and job configuration options</p>
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
</li>
|
|
244
|
+
|
|
245
|
+
</ul>
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
<p class="tag_title">Options Hash (<tt>**args</tt>):</p>
|
|
251
|
+
<ul class="option">
|
|
252
|
+
|
|
253
|
+
<li>
|
|
254
|
+
<span class="name">:wait</span>
|
|
255
|
+
<span class="type">(<tt>ActiveSupport::Duration</tt>)</span>
|
|
256
|
+
<span class="default">
|
|
257
|
+
|
|
258
|
+
</span>
|
|
259
|
+
|
|
260
|
+
— <div class='inline'><p>delay before execution (e.g., 5.minutes)</p>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
</li>
|
|
264
|
+
|
|
265
|
+
<li>
|
|
266
|
+
<span class="name">:wait_until</span>
|
|
267
|
+
<span class="type">(<tt>Time</tt>)</span>
|
|
268
|
+
<span class="default">
|
|
269
|
+
|
|
270
|
+
</span>
|
|
271
|
+
|
|
272
|
+
— <div class='inline'><p>specific time to execute (e.g., 2.hours.from_now)</p>
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
</li>
|
|
276
|
+
|
|
277
|
+
<li>
|
|
278
|
+
<span class="name">:queue</span>
|
|
279
|
+
<span class="type">(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
|
280
|
+
<span class="default">
|
|
281
|
+
|
|
282
|
+
</span>
|
|
283
|
+
|
|
284
|
+
— <div class='inline'><p>queue name (e.g., :low_priority)</p>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
</li>
|
|
288
|
+
|
|
289
|
+
<li>
|
|
290
|
+
<span class="name">:priority</span>
|
|
291
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
|
292
|
+
<span class="default">
|
|
293
|
+
|
|
294
|
+
</span>
|
|
295
|
+
|
|
296
|
+
— <div class='inline'><p>job priority (adapter-dependent)</p>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
</li>
|
|
300
|
+
|
|
301
|
+
<li>
|
|
302
|
+
<span class="name">:job_options</span>
|
|
303
|
+
<span class="type">(<tt>Hash</tt>)</span>
|
|
304
|
+
<span class="default">
|
|
305
|
+
|
|
306
|
+
</span>
|
|
307
|
+
|
|
308
|
+
— <div class='inline'><p>additional ActiveJob options</p>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
</li>
|
|
312
|
+
|
|
313
|
+
</ul>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<p class="tag_title">Raises:</p>
|
|
317
|
+
<ul class="raise">
|
|
318
|
+
|
|
319
|
+
<li>
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<span class='type'>(<tt><span class='object_link'><a href="Errors/JobEnqueueError.html" title="Servus::Extensions::Async::Errors::JobEnqueueError (class)">Servus::Extensions::Async::Errors::JobEnqueueError</a></span></tt>)</span>
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
—
|
|
327
|
+
<div class='inline'><p>if job enqueueing fails</p>
|
|
328
|
+
</div>
|
|
329
|
+
|
|
330
|
+
</li>
|
|
331
|
+
|
|
332
|
+
</ul>
|
|
333
|
+
|
|
334
|
+
<p class="tag_title">See Also:</p>
|
|
335
|
+
<ul class="see">
|
|
336
|
+
|
|
337
|
+
<li><span class='object_link'><a href="../../Base.html#call-class_method" title="Servus::Base.call (method)">Base.call</a></span></li>
|
|
338
|
+
|
|
339
|
+
</ul>
|
|
340
|
+
|
|
341
|
+
</div><table class="source_code">
|
|
342
|
+
<tr>
|
|
343
|
+
<td>
|
|
344
|
+
<pre class="lines">
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
60
|
|
348
|
+
61
|
|
349
|
+
62
|
|
350
|
+
63
|
|
351
|
+
64
|
|
352
|
+
65
|
|
353
|
+
66
|
|
354
|
+
67
|
|
355
|
+
68
|
|
356
|
+
69
|
|
357
|
+
70
|
|
358
|
+
71
|
|
359
|
+
72
|
|
360
|
+
73
|
|
361
|
+
74
|
|
362
|
+
75</pre>
|
|
363
|
+
</td>
|
|
364
|
+
<td>
|
|
365
|
+
<pre class="code"><span class="info file"># File 'lib/servus/extensions/async/call.rb', line 60</span>
|
|
366
|
+
|
|
367
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_call_async'>call_async</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
368
|
+
<span class='comment'># Extract ActiveJob configuration options
|
|
369
|
+
</span> <span class='id identifier rubyid_job_options'>job_options</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='symbol'>:wait</span><span class='comma'>,</span> <span class='symbol'>:wait_until</span><span class='comma'>,</span> <span class='symbol'>:queue</span><span class='comma'>,</span> <span class='symbol'>:priority</span><span class='rparen'>)</span>
|
|
370
|
+
<span class='id identifier rubyid_job_options'>job_options</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:job_options</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='comment'># merge custom job options
|
|
371
|
+
</span>
|
|
372
|
+
<span class='comment'># Remove special keys that shouldn't be passed to the service
|
|
373
|
+
</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_except!'>except!</span><span class='lparen'>(</span><span class='symbol'>:wait</span><span class='comma'>,</span> <span class='symbol'>:wait_until</span><span class='comma'>,</span> <span class='symbol'>:queue</span><span class='comma'>,</span> <span class='symbol'>:priority</span><span class='comma'>,</span> <span class='symbol'>:job_options</span><span class='rparen'>)</span>
|
|
374
|
+
|
|
375
|
+
<span class='comment'># Build job with optional delay, scheduling, or queue settings
|
|
376
|
+
</span> <span class='id identifier rubyid_job'>job</span> <span class='op'>=</span> <span class='id identifier rubyid_job_options'>job_options</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='op'>?</span> <span class='const'><span class='object_link'><a href="Job.html" title="Servus::Extensions::Async::Job (class)">Job</a></span></span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_job_options'>job_options</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'><span class='object_link'><a href="Job.html" title="Servus::Extensions::Async::Job (class)">Job</a></span></span>
|
|
377
|
+
|
|
378
|
+
<span class='comment'># Enqueue the job asynchronously
|
|
379
|
+
</span> <span class='id identifier rubyid_job'>job</span><span class='period'>.</span><span class='id identifier rubyid_perform_later'>perform_later</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
380
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
|
381
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="Errors.html" title="Servus::Extensions::Async::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Errors/JobEnqueueError.html" title="Servus::Extensions::Async::Errors::JobEnqueueError (class)">JobEnqueueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Failed to enqueue async job for </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
382
|
+
<span class='kw'>end</span></pre>
|
|
383
|
+
</td>
|
|
384
|
+
</tr>
|
|
385
|
+
</table>
|
|
386
|
+
</div>
|
|
387
|
+
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<div id="footer">
|
|
393
|
+
Generated on Fri Nov 21 00:33:23 2025 by
|
|
394
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
395
|
+
0.9.37 (ruby-3.4.4).
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
</div>
|
|
399
|
+
</body>
|
|
400
|
+
</html>
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
Exception: Servus::Extensions::Async::Errors::AsyncError
|
|
8
|
+
|
|
9
|
+
— Servus | Service Object Framework
|
|
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 = "Servus::Extensions::Async::Errors::AsyncError";
|
|
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 (A)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../../Servus.html" title="Servus (module)">Servus</a></span></span> » <span class='title'><span class='object_link'><a href="../../../Extensions.html" title="Servus::Extensions (module)">Extensions</a></span></span> » <span class='title'><span class='object_link'><a href="../../Async.html" title="Servus::Extensions::Async (module)">Async</a></span></span> » <span class='title'><span class='object_link'><a href="../Errors.html" title="Servus::Extensions::Async::Errors (module)">Errors</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">AsyncError</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>Exception: Servus::Extensions::Async::Errors::AsyncError
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
<dl>
|
|
70
|
+
<dt>Inherits:</dt>
|
|
71
|
+
<dd>
|
|
72
|
+
<span class="inheritName">StandardError</span>
|
|
73
|
+
|
|
74
|
+
<ul class="fullTree">
|
|
75
|
+
<li>Object</li>
|
|
76
|
+
|
|
77
|
+
<li class="next">StandardError</li>
|
|
78
|
+
|
|
79
|
+
<li class="next">Servus::Extensions::Async::Errors::AsyncError</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/servus/extensions/async/errors.rb</dd>
|
|
100
|
+
</dl>
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
|
105
|
+
<div class="discussion">
|
|
106
|
+
<p>Base error class for all async extension errors.</p>
|
|
107
|
+
|
|
108
|
+
<p>All async-related errors inherit from this class for easy rescue handling.</p>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="tags">
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</div><div id="subclasses">
|
|
117
|
+
<h2>Direct Known Subclasses</h2>
|
|
118
|
+
<p class="children"><span class='object_link'><a href="JobEnqueueError.html" title="Servus::Extensions::Async::Errors::JobEnqueueError (class)">JobEnqueueError</a></span>, <span class='object_link'><a href="ServiceNotFoundError.html" title="Servus::Extensions::Async::Errors::ServiceNotFoundError (class)">ServiceNotFoundError</a></span></p>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div id="footer">
|
|
133
|
+
Generated on Fri Nov 21 00:33:24 2025 by
|
|
134
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
135
|
+
0.9.37 (ruby-3.4.4).
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
</div>
|
|
139
|
+
</body>
|
|
140
|
+
</html>
|