honeydew v1.1.5 Honeydew.Workers View Source

Link to this section Summary

Functions

Creates a supervision spec for workers

Link to this section Types

Link to this type mod_or_mod_args() View Source
mod_or_mod_args() :: Honeydew.mod_or_mod_args()
Link to this type worker_spec_opt() View Source
worker_spec_opt() :: Honeydew.worker_spec_opt()

Link to this section Functions

Link to this function child_spec(list) View Source
child_spec([...]) :: Supervisor.Spec.spec()

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 Honeydew.Worker.init/1 args with {module, args}.

You can provide any of the following opts:

  • num: the number of workers to start. Defaults to 10.

  • init_retry: the amount of time, in seconds, to wait before respawning a worker whose Honeydew.Worker.init/1 function failed. Defaults to 5.

  • shutdown: if a worker is in the middle of a job, the amount of time, in milliseconds, to wait before brutally killing it. Defaults to 10_000.

  • supervisor_opts options accepted by Supervisor.Spec.supervisor/3.

  • nodes: for :global queues, you can provide a list of nodes to stay connected to (your queue node and enqueuing nodes). Defaults to [].

For example:

  • Honeydew.child_spec("my_awesome_queue", MyJobModule)

  • Honeydew.child_spec("my_awesome_queue", {MyJobModule, [key: "secret key"]}, num: 3)

  • Honeydew.child_spec({:global, "my_awesome_queue"}, MyJobModule, nodes: [:clientfacing@dax, :queue@dax])