create_job ?max_tries ?retry_delay ?failed handle encode decode name returns a job that can be placed on the queue (dispatched) for later processing.
max_tries is the maximum times a job can fail. If a job fails max_tries number of times, the status of the job becomes Failed. By default, a job can fail 5 times.
retry_delay is the time span between two retries. By default, this value is one minute.
failed is the error handler that is called when handle returns an error or raises an exception. By default, this function does nothing. Use failed to clean up resources or raise some error in a monitoring system in case a job fails.
handle is the function that is called with the input when processing the job. If an exception is raised, the exception is turned into Error.
encode is called right after dispatching a job. The provided input data is encoded as string which is used for persisting the queue.
decode is called before starting to process a job. decode turns the persisted string into the input data that is passed to the handle function.
name is the name of the job, it has to be unique among all registered jobs.