GoodJob.Job.Instance (good_job v1.0.0)

Copy Markdown View Source

Represents a job instance that can be directly executed.

Created by MyJob.new(args) and executed with .perform.

Summary

Functions

Creates a new job instance.

Executes the job directly without enqueueing.

Types

t()

@type t() :: %GoodJob.Job.Instance{
  args: map() | list() | term(),
  job_module: module(),
  options: keyword()
}

Functions

new(job_module, args \\ %{}, options \\ [])

Creates a new job instance.

perform(instance)

@spec perform(t()) :: term()

Executes the job directly without enqueueing.

Similar to Rails ActiveJob's job.perform.

Examples

job = MyJob.new(%{data: "hello"})
job.perform()