Giter Site home page Giter Site logo

Comments (3)

edgurgel avatar edgurgel commented on May 20, 2024

Verk does not saves the queues that were started dynamically. The initial configuration should have them or when Verk starts, add the queues back again dynamically.

One common use case is to start a supervision tree with the Verk.Supervisor then a process that adds the dynamic queues when it starts. So if the supervision tree restarts it will guarantee that the queues were added. I can add more information and examples around this if needed.

from verk.

salisbury-espinosa avatar salisbury-espinosa commented on May 20, 2024

I can add more information and examples around this if needed.

I would be very grateful to you)

from verk.

edgurgel avatar edgurgel commented on May 20, 2024

You could for example have a supervisor that has the following supervision tree:

tree = [supervisor(Verk.Supervisor, []), worker(QueuesLoader, [])]
opts = [name: MySupervisor, strategy: :rest_for_one]
Supervisor.start_link(tree, opts)

The QueuesLoader can be a GenServer that looks like this:

defmodule QueuesLoader do
  use GenServer
  require Logger

  @doc false
  def start_link do
    GenServer.start_link(__MODULE__, [], name: __MODULE__)
  end

  @doc false
  def init(_args) do
    for queues <- MyQueues.all do
      Verk.add_queue(...)
    end
    { :ok, nil }
  end
end

Notice that this supervisor is a rest_for_one so that if Verk.Supervisor crashes, it will restart the QueuesLoader worker as it's defined after the Verk.Supervisor.

from verk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.