ObanChore transforms standard Oban workers into secure, UI-driven operational tools.
It eliminates the need for manual IEx interaction by providing a dashboard to trigger and monitor background jobs with a user-friendly interface.
Quick Start
Getting started with ObanChore takes just a few steps:
Install the dependency in your
mix.exs:{:oban_chore, "~> 0.3"}Configure the Plugin in your Oban settings:
config :my_app, Oban, repo: MyApp.Repo, plugins: [ {ObanChore.Plugin, otp_app: :my_app, pubsub_server: MyApp.PubSub} ]Mount the Dashboard in your
router.ex:import ObanChore.Router # ... oban_chore_dashboard "/ops/chores"Define a Chore by using
ObanChore.Worker:defmodule MyApp.Workers.MyChore do use ObanChore.Worker, name: "My Operational Task", fields: [user_id: [type: :integer, required: true]] @impl Oban.Worker def perform(%Oban.Job{args: %{"user_id" => id}}) do # logic... :ok end end
Real-Time Logs
You can stream logs from your worker directly to the dashboard using log/2.
See the log/2 documentation below for examples.
Summary
Functions
Counts the number of active jobs (available, scheduled, or executing) for a given worker module.
Lists the active (available, scheduled, executing) jobs for a given worker module.
Logs a message to the ObanChore dashboard for a specific job.
Checks if a job with the specified arguments is already in an active state.
Functions
Counts the number of active jobs (available, scheduled, or executing) for a given worker module.
Lists the active (available, scheduled, executing) jobs for a given worker module.
Returns a list of %Oban.Job{} structs with the state converted to an atom.
Logs a message to the ObanChore dashboard for a specific job.
This is intended to be used inside your worker's perform/1 function to stream
progress updates or important information back to the UI in real-time.
Examples
def perform(%Oban.Job{} = job) do
ObanChore.log(job, "Initializing backfill...")
# ... logic ...
ObanChore.log(job, "Successfully processed users.")
:ok
end
Checks if a job with the specified arguments is already in an active state.
Active states include available, scheduled, and executing.