th3mus1cman

th3mus1cman

Issues with starting multiple Broadway pipelines with DynamicSupervisor

Is it possible to start a Broadway pipeline with a DynamicSupervisor? Well, it is possible start at least one but when I try to start multiple only the first one starts.

I tried overriding the default child_spec with

%{
    id: "#{__MODULE__}:#{unique_id}",
    start: {__MODULE__, :start_link, [destination: destination]},
    shutdown: :infinity
}

but then none of the pipelines start and I am getting zero errors.

I overrode the default child_spec because this is the implementation:

default = %{
          id: unquote(module),
          start: {__MODULE__, :start_link, [arg]},
          shutdown: :infinity
        }

I have also defined a process_name:

  @impl Broadway
  def process_name({:via, module, {registry, name}}, base_name) do
    {:via, module, {registry, "#{base_name}:#{name}"}}
  end

This is how I am starting the pipeline:

DynamicSupervisor.start_child(
    ER.DynamicSupervisor,
    {ER.Destinations.Pipeline.S3, [destination: destination]}
)
  def start_link(opts) do
    broadway_config = get_broadway_config(opts[:destination])

    context = %{
      destination: broadway_config.destination
    }

    result =
      Broadway.start_link(__MODULE__,
        name: broadway_config.name,
        producer: [
          module:
            {OffBroadwayEcto.Producer,
             client: {ER.Destinations.Pipeline.Client, [destination: broadway_config.destination]}}
        ],
        context: context,
        processors: [
          default: [concurrency: broadway_config.processor_concurrency]
        ],
        batchers: [
          s3: [
            concurrency: broadway_config.batcher_concurrency,
            batch_size: broadway_config.batch_size,
            batch_timeout: broadway_config.batch_timeout
          ]
        ]
      )

Anyone have any ideas what I could be doing it wrong? Or if it is possible? Thanks

First Post!

dimitarvp

dimitarvp

Have you been able to solve this? Admittedly I can’t offer help as I haven’t worked with Broadway for a while – but I also never tried what you do.

Last Post!

th3mus1cman

th3mus1cman

Sadly I have not yet solved the problem. I did open an issue on the Broadway repo on Github. At this point I am thinking it is something internal to Broadway that is the issue but always open to it being my code. :wink:

If I can’t structure my pipelines this way I have been thinking about alternatives. I just don’t like anything that I have come up with yet. I have thought about trying to use a regular supervisor and not a dynamic supervisor but I just don’t know why that difference would matter. I am not an expert on the differences between the two so maybe there is something there that is causing an issue.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
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

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36654 110
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
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement