awesome1990

awesome1990

How to use Quantum?

Am new to Elixir and i need help how to schedule a task…

defmodule PluralsightTweet.Scheduler do
  def schedule_file(schedule, file) do
    Quantum.add_job(schedule, fn -> IO.puts PluralsightTweet.FileReader.get_strings_to_tweet(file) end)
  end
end

this is the error am getting:

Quantum.add_job(“* * * * * * “, fn-> IO.puts “test” end)
** (UndefinedFunctionError) function Quantum.add_job/2 is undefined or private
(quantum) Quantum.add_job(”
* * * * * *”, function<20.99386804/0 in :erl_eval.expr/5>)

Most Liked

kelvinst

kelvinst

That’s not how you must use Quantum, follow their documentation on: https://hexdocs.pm/quantum/readme.htm

More details:

  • Quantum.add_job/2 is not a function, maybe what you mean is Quantum.Scheduler.add_job/2
  • Quantum.Scheduler.add_job/2 is not a function also, and yes a callback that should be defined by the modules that use @behaviour Quantum.Scheduler

My impression is that you may be confusing what the lib quantum really is. It’s not a job scheduler like, for example, sidekiq, what it does is something like what the command line tool cron does, scheduling recurrent executions.

Last Post!

kelvinst

kelvinst

By scheduling you mean running it once in the future or recurrently?

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New

Other popular topics Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement