Exq.Enqueuer (exq v0.16.0) View Source
Enqueuer.
Link to this section Summary
Functions
Enqueue a job immediately.
Schedule a job to be enqueued at a specific time in the future.
Schedule a job to be enqueued at in the future given by offset in seconds.
Link to this section Functions
Enqueue a job immediately.
Expected args:
pid
- PID for Exq Manager or Enqueuer to handle thisqueue
- Name of queue to useworker
- Worker module to targetargs
- Array of args to send to workeroptions
- job options, for example [max_retries:Integer
, jid:String
]
Returns:
{:ok, jid}
if the job was enqueued successfully, withjid
= Job ID.{:error, reason}
if there was an error enqueueing job
Schedule a job to be enqueued at a specific time in the future.
Expected args:
pid
- PID for Exq Manager or Enqueuer to handle thisqueue
- name of queue to usetime
- Time to enqueueworker
- Worker module to targetargs
- Array of args to send to workeroptions
- job options, for example [max_retries:Integer
, jid:String
]
If Exq is running in mode: [:enqueuer]
, then you will need to use the Enqueuer
to schedule jobs, for example:
time = Timex.now() |> Timex.shift(days: 8)
Exq.Enqueuer.enqueue_at(Exq.Enqueuer, "default", time, MyWorker, ["foo"])
Schedule a job to be enqueued at in the future given by offset in seconds.
Expected args:
pid
- PID for Exq Manager or Enqueuer to handle thisqueue
- Name of queue to useoffset
- Offset in seconds in the future to enqueueworker
- Worker module to targetargs
- Array of args to send to workeroptions
- job options, for example [max_retries:Integer
]
If Exq is running in mode: [:enqueuer]
, then you will need to use the Enqueuer
to schedule jobs, for example:
Exq.Enqueuer.enqueue_in(Exq.Enqueuer, "default", 5000, MyWorker, ["foo"])