View Source AshOban (ash_oban v0.1.12)

Tools for working with AshOban triggers.

Summary

Functions

Alters your oban configuration to include the required AshOban configuration.

Runs the schedulers for the given resource, api, or otp_app, or list of resources, apis, 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.Api.t() | atom()

Functions

Link to this function

config(apis, base, opts \\ [])

View Source

Alters your oban configuration to include the required AshOban configuration.

Options

Link to this function

do_schedule_and_run_triggers(resources_or_apis_or_otp_apps, opts)

View Source
Link to this function

run_trigger(record, trigger, oban_job_opts \\ [])

View Source
Link to this function

schedule(resource, trigger)

View Source
Link to this function

schedule_and_run_triggers(resources_or_apis_or_otp_apps, opts \\ [])

View Source
@spec schedule_and_run_triggers(
  triggerable() | [triggerable()],
  keyword()
) :: result()

Runs the schedulers for the given resource, api, or otp_app, or list of resources, apis, or otp_apps.

Options:

  • drain_queues? - Defaults to false, drains the queues after scheduling. This is primarily for testing
  • queue, with_limit, with_recursion, with_safety, with_scheduled - passed through to Oban.drain_queue/2, if it is called
  • scheduled_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.

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 api configured in the ash_apis of that otp_app is passed into schedule_and_run_triggers/1, and the results are merged together.
  • an api - each reosurce configured in that api 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.