hi all, I’m getting a warning in my GenStage code:
warning: Supervisor.Spec.worker/3 is deprecated. Use the new child specifications outlined in the Supervisor module instead
lib/markably/rest_queues/store_mby_tasks_queue/store_mby_tasks_producer_consumer.ex:6: Markably.StoreMbyTasksProducerConsumer.start_link/1
and I’m initializing the ProducerConsumer as such:
def start_link([%{producer: producer, processor: processor}]) do
children = [
worker(processor, [], restart: :temporary)
]
ConsumerSupervisor.start_link(children,
strategy: :one_for_one,
subscribe_to: [
{
producer,
min_demand: 2,
max_demand: 10
}
]
)
end
the issue is with the worker()
function reference. How do I initialize it?
I tried replacing
worker(processor, [], restart: :temporary)
with
{processor, restart: :temporary}
and I get the error: The module Markably.UpdateMbyTasksAggregator was given as a child to a supervisor but it does not implement child_spec/1.
I am calling it from application.ex like this:
{Markably.UpdateMbyTasksProducer, name: Markably.UpdateMbyTasksProducer},
{Markably.UpdateMbyTasksProducerConsumer, [%{producer: Markably.UpdateMbyTasksProducer, processor: Markably.UpdateMbyTasksAggregator}]},
I figured just changing the worker() to a tuple and removing the extra param would be enough to tell OTP that this is the child node to add? But apparently not?
regards,
Michael