honeydew v1.0.0-rc1 Honeydew

Summary

Functions

async(task, queue, opts \\ [])
cancel(job)
filter(queue, function)
queue_spec(name, opts \\ [])

Creates a supervision spec for a queue.

name is how you’ll refer to the queue to add a task.

You can provide any of the following opts:

  • queue is the module that queue will use, you may also provide init/1 args: {module, args}
  • dispatcher the job dispatching strategy, must implement the GenStage.Dispatcher behaviour
  • failure_mode: the way that failed jobs should be handled. You can pass either a module, or {module, args}, the module must implement the Honeydew.FailureMode behaviour. args defaults to [].

For example: Honeydew.queue_spec("my_awesome_queue") Honeydew.queue_spec("my_awesome_queue", queue: {MyQueueModule, [ip: "localhost"]})

resume(queue)
state(queue)
status(queue)
suspend(queue)
worker_spec(name, module_and_args, opts \\ [])

Creates a supervision spec for workers.

queue is the name of the queue that the workers pull jobs from module is the module that the workers in your queue will use, you may also provide init/1 args: {module, args}

You can provide any of the following opts:

  • num: the number of workers to start
  • init_retry: the amount of time, in milliseconds, to wait before respawning a worker who’s init/1 function failed
  • shutdown: if a worker is in the middle of a job, the amount of time, in milliseconds, to wait before brutally killing it.

For example: Honeydew.worker_spec("my_awesome_queue", MyJobModule) Honeydew.worker_spec("my_awesome_queue", {MyJobModule, [key: "secret key"]}, num: 3)

yield(job, timeout \\ 5000)