View Source AshOban (ash_oban v0.2.6)
Tools for working with AshOban triggers.
Summary
Functions
Builds a specific trigger for the record provided, but does not insert it into the database.
Alters your oban configuration to include the required AshOban configuration.
Runs a specific trigger for the record provided.
Schedules all relevant jobs for the provided trigger or scheduled action
Runs the schedulers for the given resource, domain, or otp_app, or list of resources, domains, or otp_apps.
Types
@type result() :: %{ discard: non_neg_integer(), cancelled: non_neg_integer(), success: non_neg_integer(), failure: non_neg_integer(), snoozed: non_neg_integer(), queues_not_drained: [atom()] }
@type triggerable() :: Ash.Resource.t() | {Ash.Resource.t(), atom()} | Ash.Domain.t() | atom()
Functions
@spec authorize?() :: boolean()
Builds a specific trigger for the record provided, but does not insert it into the database.
Options
:actor
- the actor to set on the job. Requires configuring an actor persister.:action_arguments
- additional arguments to merge into the action invocation's arguments map. affects the uniqueness checks for the job.:args
- additional arguments to merge into the job's arguments map. the action will not use these arguments, it can only be used to affect the job uniqueness checks. you likely are looking for the:action_arguments
job.
All other options are passed through to Oban.Worker.new/2
Alters your oban configuration to include the required AshOban configuration.
Options
:require?
(boolean/0
) - Whether to require queues and plugins to be defined in your oban config. This can be helpful to allow the ability to split queues between nodes. See https://hexdocs.pm/oban/splitting-queues.html The default value istrue
.
do_schedule_and_run_triggers(resources_or_domains_or_otp_apps, opts)
View SourceRuns a specific trigger for the record provided.
Options
:actor
- the actor to set on the job. Requires configuring an actor persister.:args
- additional arguments to merge into the job's arguments map.
All other options are passed through to Oban.Worker.new/2
Schedules all relevant jobs for the provided trigger or scheduled action
Options
:actor
- the actor to set on the job. Requires configuring an actor persister.
schedule_and_run_triggers(resources_or_domains_or_otp_apps, opts \\ [])
View Source@spec schedule_and_run_triggers( triggerable() | [triggerable()], keyword() ) :: result()
Runs the schedulers for the given resource, domain, or otp_app, or list of resources, domains, or otp_apps.
Options:
drain_queues?
- Defaults to false, drains the queues after scheduling. This is primarily for testingqueue
,with_limit
,with_recursion
,with_safety
,with_scheduled
- passed through toOban.drain_queue/2
, if it is calledscheduled_actions?
- Defaults to false, unless a scheduled action name was explicitly provided. Schedules all applicable scheduled actions.triggers?
- Defaults to true, schedules all applicable scheduled actions.actor
- The actor to schedule and run the triggers withoban
- The oban module to use. Defaults toOban
If the input is:
- a list - each item is passed into
schedule_and_run_triggers/1
, and the results are merged together. - an otp_app - each domain configured in the
ash_domains
of that otp_app is passed intoschedule_and_run_triggers/1
, and the results are merged together. - a domain - each reosurce configured in that domain is passed into
schedule_and_run_triggers/1
, and the results are merged together. - a tuple of {resource, :trigger_name} - that trigger is scheduled, and the results are merged together.
- a resource - each trigger configured in that resource is scheduled, and the results are merged together.