-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to restore dynamically added queues #117
Comments
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 |
I would be very grateful to you) |
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 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 |
How to restore queues with data from redis after the application restart, which have been added dynamically
Verk.add_queue(:new, 10)
At the initial startup, the supervisor only reads the data from the config
verk/lib/verk/supervisor.ex
Line 19 in 062811e
The text was updated successfully, but these errors were encountered: