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

Hello!
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?

Thanks

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 GitHub - samsondav/rihanna: Rihanna is a high performance postgres-backed job queue for Elixir · GitHub that afaik works somewhat similarly)

there is also SchedEx GitHub - SchedEx/SchedEx: Simple scheduling for Elixir · GitHub

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 Quantum — Quantum v3.5.3 but it isn’t easy.

Thanks

https://hexdocs.pm/quantum/runtime.html

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.