Assembly Line v0.5.0 AssemblyLine.Job
Provides the job struct as well as functions for manipulating the job struct
The Job Struct
This struct is intended to hold the meta-data for a job to be performed. It has the following attributes:
task
worker
args
result
The task
attribute usually holds some kind of reference to the entry point
for the work, that could be an Elixir Module or even another type of reference
if the job is to be processed by another system/application.
The worker
attribute holds the name of the module that should perform the
task. The module specified here should implement the AssemblyLine.Worker
behaviour.
The args
attribute should be a list of arguments for the task reference.
This list should contain the data needed for the job to be executed.
The result
attribute holds the outcome of the work.
Summary
Functions
Sets the result
attribute for a Job Struct
Types
t :: %AssemblyLine.Job{args: list, result: term, task: term, worker: atom}
Functions
Specs
set_result(AssemblyLine.Job.t, term) :: AssemblyLine.Job.t
Sets the result
attribute for a Job Struct.
Returns a Job Struct with the result
attribute set.
Examples
iex> job = %AssemblyLine.Job{task: ZoneCreator, args: [{:add, cname_struct}]}
iex> AssemblyLine.Job.set_result(job, :ok)
%AssemblyLine.Job{task: ZoneCreator, args: [{:add, cname_struct}], result: :ok}