Skip to content
Mike Perham edited this page Oct 18, 2017 · 16 revisions

A Faktory job is a JSON hash with a few mandatory elements. The bare minimum:

{
  "jid": "123861239abnadsa",
  "jobtype": "SomeName",
  "args": [1, 2, "hello"],
}

The worker uses jobtype to determine how to execute this job, the args provide necessary state for the job to run. JID is a unique ID for each job.

Options

You can customize Faktory's behavior by setting additional elements in the JSON hash:

  • "queue": "default" - push this job to a particular queue. The default queue is "default".
  • "reserve_for": 600 - set the reservation timeout for a job, in seconds. After this time, the job will be requeued for execution by another worker. Default is 1800 seconds or 30 minutes, minimum is 60 seconds.
  • "at": "2017-12-20T15:30:17.111222333Z" - schedule a job to run at a point in time. The job will be enqueued within a few seconds of that point in time. Note the string must be in Go's RFC3339Nano time format.
  • "retry": 3 - set the number of retries to perform if this job fails. Default is 25 (which, with exponential backoff, means Faktory will retry the job over a 21 day period). A value of 0 means the job will not be retried and will be discarded if it fails. A value of -1 means don't retry but move the job immediately to the Dead set if it fails.
  • "backtrace": 10 - retain up to N lines of backtrace given to the FAIL command.
Clone this wiki locally