-
Notifications
You must be signed in to change notification settings - Fork 155
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
Using via_tuple as name
#236
Comments
It is doable but not supported right now because we name each individual process in the Broadway tree. So if we want to support something similar, we probably need a |
Got it @josevalim. To make sure I'm following, for the PR I assume I'd address all the call sites for |
Yes, and the places we build the names after config.name. Yeah! |
Hey @josevalim – started hacking at this. Issue I ran into: a via tuple can take most any form, right? Because the generic form is this: {:via, Registry, {custom_registry_name, args_forwarded_to_custom_registry}} Therefore these are both valid via tuples: {:via, Registry, {MyRegistry, MyBroadway}}
{:via, Registry, {MyRegistry, {MyBroadway, "some-id"}}} This flexibility presents a challenge because presumably we'd want to use via tuples to name the processes in the rest of the topology. But if Re-reading your comment, maybe you're suggesting that we allow the id = "1-asdf"
Broadway.start_link(Forwarder,
name: MyRegistry.via_tuple({Forwarder, id}),
naming: fn base_name -> MyRegistry.via_tuple({:"Forwarder.#{base_name}", id}) end
# ...
) Another possibility is I'm barking up the wrong tree and I don't need a via tuple. I'll be starting lots of Broadway pipelines, so I want their names to be dynamic. In the past with GenServers, I've used via tuples in this situation that included a UUID. Perhaps instead I can get away with naming these pipelines eg Thanks! |
The problem with generating atoms like that is that you will eventually exhaust the atom table. So if you do that based on user input, you will have an issue. |
However, if you do it based on another value which is bound, say a predefined number of Kafka topics, then that’s fine. |
Thanks. I can get by with just using atoms for the short-term, but can see how via tuple would be desirable in long run. I just realized we could have the pipeline module that invokes
Do you like this approach or should we consider something else? |
@acco yes! that's the approach i originally had in mind :) but the approach with the function was equivalent enough. |
Hey team,
Great project :) I want to use a via_tuple for my Broadway server's
name
. This is because we'll be spinning up many pipelines. But running an issue becausename
is enforced to be an atom:https://github.com/dashbitco/broadway/blob/master/lib/broadway/options.ex#L6-L13
Am I missing something? / would a via_tuple be desirable to support here?
Thanks,
Anthony
The text was updated successfully, but these errors were encountered: