How to do a job in user defined date and time (like schedule a job)

I want to do like schedule sending email.

  1. customer(user) set date and time for sending email.
  2. app sends email at given time.

is there any package in elixir?
or should I implement manually?


I tend to use the Quantum library for such things.


or EctoJob - if you want/need persistence (which afaik quantum doesn’t provide) EctoJob: A transactional job queue built with Ecto, PostgreSQL and GenStage (or Rihanna that afaik works somewhat similarly)

there is also SchedEx

I use quantum for fixed scheduled jobs (eg every hour) - and would probably go for EctoJob for on-demand scheduled jobs… ymmv obviously


Oh yes, I am using Quantum for cleaning up database something like that.
and and I configured in config.exs

config  :texting, Texting.Scheduler,
  jobs: [
    {"@daily", {Texting.Cronjob, :remove_orders, []}}

and it is global job.

does quantum work as individual scheduler also? if it does, can you give me a link to the doc? I am trying to find docs in but it isn’t easy.


Though it won’t persist through reboots, for that you’d want EctoJob or so (or serialize it yourself, pretty trivial to do), but if it’s just a janitorial cleanup or something then it’s perfect. :slight_smile:

Thanks! I will look into that.

1 Like