Packages
ash_oban
0.1.12
0.8.10
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0-rc.1
0.8.0-rc.0
0.7.2
0.7.1
0.7.0
0.6.0
0.5.1
0.5.0
0.4.12
0.4.11
0.4.10
0.4.9
0.4.8
0.4.7
0.4.6
0.4.5
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.6
0.2.5
0.2.4
0.2.3
0.2.3-rc.1
0.2.3-rc.0
0.2.2
0.2.1
0.2.0
0.1.14
0.1.13
0.1.12
0.1.11
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
The extension for integrating Ash resources with Oban.
Current section
Files
Jump to
Current section
Files
documentation/dsls/DSL:-AshOban.cheatmd
<!--
This file was generated by Spark. Do not edit it by hand.
-->
# DSL: AshOban
Tools for working with AshOban triggers.
## oban
### Nested DSLs
* [triggers](#oban-triggers)
* trigger
* [scheduled_actions](#oban-scheduled_actions)
* schedule
### Examples
```
oban do
api AshOban.Test.Api
triggers do
trigger :process do
action :process
where expr(processed != true)
worker_read_action(:read)
end
end
end
```
### Options
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th colspan=2>Docs</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a id="oban-api" href="#oban-api">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
api
</span>
</a>
<sup style="color: red">*</sup>
</td>
<td style="text-align: left">
<code class="inline">module</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The Api module to use when calling actions on this resource
</td>
</tr>
</tbody>
</table>
## oban.triggers
### Nested DSLs
* [trigger](#oban-triggers-trigger)
### Examples
```
triggers do
trigger :process do
action :process
where expr(processed != true)
worker_read_action(:read)
end
end
```
## oban.triggers.trigger
```elixir
trigger name
```
### Examples
```
trigger :process do
action :process
where expr(processed != true)
worker_read_action(:read)
end
```
### Options
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th colspan=2>Docs</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a id="name-action" href="#name-action">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
action
</span>
</a>
<sup style="color: red">*</sup>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The action to be triggered. Defaults to the identifier of the resource plus the name of the trigger
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-name" href="#name-name">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
name
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
A unique identifier for this trigger.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-action_input" href="#name-action_input">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
action_input
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">map</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
Static inputs to supply to the update/destroy action when it is called. Any metadata produced by `read_metadata` will overwrite these values.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-scheduler_queue" href="#name-scheduler_queue">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
scheduler_queue
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The queue to place the scheduler job in. The same queue as job is used by default (but with a priority of 1 so schedulers run first).
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-debug?" href="#name-debug?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
debug?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">false</code>
</td>
<td style="text-align: left" colspan=2>
If set to `true`, detailed debug logging will be enabled for this trigger. You can also set `config :ash_oban, debug_all_triggers?: true` to enable debug logging for all triggers.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-scheduler_cron" href="#name-scheduler_cron">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
scheduler_cron
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t | false</code>
</td>
<td style="text-align: left">
<code class="inline">"* * * * *"</code>
</td>
<td style="text-align: left" colspan=2>
A crontab configuration for when the job should run. Defaults to once per minute ("* * * * *"). Use `false` to disable the scheduler entirely.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-stream_batch_size" href="#name-stream_batch_size">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
stream_batch_size
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">pos_integer</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The batch size to pass when streaming records from using `c:Ash.Api.stream!/2`. No batch size is passed if none is provided here, so the default is used.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-queue" href="#name-queue">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
queue
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The queue to place the worker job in. The trigger name is used by default.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-record_limit" href="#name-record_limit">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
record_limit
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">pos_integer</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
If set, any given run of the scheduler will only ever schedule this many items maximum
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-log_errors?" href="#name-log_errors?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
log_errors?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">true</code>
</td>
<td style="text-align: left" colspan=2>
Whether or not to log errors that occur when performing an action.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-log_final_error?" href="#name-log_final_error?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
log_final_error?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">true</code>
</td>
<td style="text-align: left" colspan=2>
If true, logs that an error occurred on the final attempt to perform an action even if `log_errors?` is set to false.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-worker_priority" href="#name-worker_priority">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
worker_priority
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">non_neg_integer</code>
</td>
<td style="text-align: left">
<code class="inline">2</code>
</td>
<td style="text-align: left" colspan=2>
A number from 0 to 3, where 0 is the highest priority and 3 is the lowest.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-scheduler_priority" href="#name-scheduler_priority">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
scheduler_priority
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">non_neg_integer</code>
</td>
<td style="text-align: left">
<code class="inline">3</code>
</td>
<td style="text-align: left" colspan=2>
A number from 0 to 3, where 0 is the highest priority and 3 is the lowest.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-max_scheduler_attempts" href="#name-max_scheduler_attempts">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
max_scheduler_attempts
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">pos_integer</code>
</td>
<td style="text-align: left">
<code class="inline">1</code>
</td>
<td style="text-align: left" colspan=2>
How many times to attempt scheduling of the triggered action.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-max_attempts" href="#name-max_attempts">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
max_attempts
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">pos_integer</code>
</td>
<td style="text-align: left">
<code class="inline">1</code>
</td>
<td style="text-align: left" colspan=2>
How many times to attempt the job. After all attempts have been exhausted, the scheduler may just reschedule it. Use the `on_error` action to update the record to make the scheduler no longer apply.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-read_metadata" href="#name-read_metadata">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
read_metadata
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">(any -> any)</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
Takes a record, and returns metadata to be given to the update action as an argument called `metadata`.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-state" href="#name-state">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
state
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:active | :paused | :deleted</code>
</td>
<td style="text-align: left">
<code class="inline">:active</code>
</td>
<td style="text-align: left" colspan=2>
Describes the state of the cron job. See the getting started guide for more information. The most important thing is that you *do not remove a trigger from a resource if you are using oban pro*.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-read_action" href="#name-read_action">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
read_action
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The read action to use when querying records. Defaults to the primary read. This action *must* support keyset pagination.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-worker_read_action" href="#name-worker_read_action">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
worker_read_action
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The read action to use when fetching the individual records for the trigger. Defaults to `read_action`. If you customize this, ensure your action handles scenarios where the trigger is no longer relevant.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-where" href="#name-where">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
where
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">`any`</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The filter expression to determine if something should be triggered
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-on_error" href="#name-on_error">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
on_error
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
An update action to call after the last attempt has failed. See the getting started guide for more.
</td>
</tr>
</tbody>
</table>
### Introspection
Target: `AshOban.Trigger`
## oban.scheduled_actions
A section for configured scheduled actions. Supports generic and create actions.
### Nested DSLs
* [schedule](#oban-scheduled_actions-schedule)
### Examples
```
scheduled_actions do
schedule :import, "0 */6 * * *", action: :import
end
```
## oban.scheduled_actions.schedule
```elixir
schedule name, cron
```
### Options
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th colspan=2>Docs</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a id="name-cron-name" href="#name-cron-name">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
name
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
A unique identifier for this scheduled action.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-cron" href="#name-cron-cron">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
cron
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The schedule in crontab notation
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-action_input" href="#name-cron-action_input">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
action_input
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">map</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
Inputs to supply to the action when it is called.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-action" href="#name-cron-action">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
action
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The generic or create action to call when the schedule is triggered.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-queue" href="#name-cron-queue">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
queue
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The queue to place the job in. Defaults to the resources short name plus the name of the scheduled action (not the action name).
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-state" href="#name-cron-state">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
state
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:active | :paused | :deleted</code>
</td>
<td style="text-align: left">
<code class="inline">:active</code>
</td>
<td style="text-align: left" colspan=2>
Describes the state of the cron job. See the getting started guide for more information. The most important thing is that you *do not remove a scheduled action from a resource if you are using oban pro*.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-max_attempts" href="#name-cron-max_attempts">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
max_attempts
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">pos_integer</code>
</td>
<td style="text-align: left">
<code class="inline">1</code>
</td>
<td style="text-align: left" colspan=2>
How many times to attempt the job. The action will receive a `last_oban_attempt?` argument on the last attempt, and you should handle errors accordingly.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-priority" href="#name-cron-priority">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
priority
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">non_neg_integer</code>
</td>
<td style="text-align: left">
<code class="inline">3</code>
</td>
<td style="text-align: left" colspan=2>
A number from 0 to 3, where 0 is the highest priority and 3 is the lowest.
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="name-cron-debug?" href="#name-cron-debug?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
debug?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">false</code>
</td>
<td style="text-align: left" colspan=2>
If set to `true`, detailed debug logging will be enabled for this trigger. You can also set `config :ash_oban, debug_all_triggers?: true` to enable debug logging for all triggers.
</td>
</tr>
</tbody>
</table>
### Introspection
Target: `AshOban.Schedule`