faktory_worker_ex v0.5.0 Faktory.Job behaviour
Use this module to create your job processors.
Getting started
All that is required is to define a perform
function that takes zero or more
arguments.
defmodule MyFunkyJob do
use Faktory.Job
def perform(arg1, arg2) do
# ... do something ...
end
end
# To enqueue jobs of this type.
MyFunkyJob.perform_async([1, "foo"])
Notice perform_async
takes a list who’s size must match exactly the airty of
perform
.
Configuring
You can configure various aspects of the job by passing a keyword list to
faktory_options/1
. All keys are optional and their default values are
shown in the example below.
defmodule MyFunkyJob do
use Faktory.Job
faktory_options queue: "default", retry: 25, backtrace: 0
# ...
end
Runtime overrides
You can override faktory_options
when enqueuing a job.
MyFunkyJob.perform_async([1, "foo"], queue: "not_default")
MyFunkyJob.perform_async([2, "bar"], retry: 0)
Link to this section Summary
Functions
Set default options for all jobs of this type
Link to this section Types
Link to this section Functions
Link to this section Callbacks
Link to this callback
perform_async(args, options)