Durable.Scheduler.DSL (Durable v0.1.0-rc)

View Source

Provides the @schedule decorator for declaring workflow schedules.

Usage

defmodule MyApp.DailyReport do
  use Durable
  use Durable.Scheduler.DSL

  @schedule cron: "0 9 * * *", timezone: "America/New_York"
  workflow "generate_report" do
    step :fetch_data do
      # ...
    end

    step :generate do
      # ...
    end
  end
end

Then register the module in your supervision tree:

{Durable, repo: MyApp.Repo, scheduled_modules: [MyApp.DailyReport]}

Options

  • :cron - Cron expression (required)
  • :name - Schedule name (defaults to workflow name)
  • :timezone - Timezone for cron evaluation (default: "UTC")
  • :input - Static input for each execution (default: %{})
  • :queue - Queue to run on (default: :default)

Summary

Functions

Injects schedule handling into the calling module.

Called internally to capture the @schedule attribute before a workflow.

Functions

__using__(opts)

(macro)

Injects schedule handling into the calling module.

capture_schedule(module, workflow_name)

Called internally to capture the @schedule attribute before a workflow.

This function is used by patching the workflow macro to capture schedules.