-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add services dynamically with tonic #886
Comments
Unless axum supports this (cc @davidpdrsn ) its likely we won't add this support since its likely to either add perf issues or complexity. |
Axum makes it a bit easier (once the Router type doesn't change as you add routes) but a vec of closures that returns generic services is going to be hard no matter what I think. I agree this probably isn't something we want to support since it's likely to add more complexity. |
Yeah I understand, it does add a lot of complexity. I'm working on a solution that would implies a public expose of I'm closing this as it won't be implemented. |
Thanks for understanding :) |
FWIW I think the change from @davidpdrsn in #830 may help this ticket significantly (because the Router no longer has so many generic types) |
Specifically, in the above example for service in grpc_services {
// this type is `Router<Routes>`
server = server.add_service(service(Arc::clone(&context)));
} |
Feature Request
Hello 👋!
Thread from discord which motivated this issue creation: https://discord.com/channels/500028886025895936/628706823104626710/930507181516795944
Motivation
I want to dynamically add services where those services would be initialized later.
For instance, let's suppose we want a Builder pattern to create GRPC services based on a Shared Context where you could register your Service creation function.
It won't work due to the typing of the successive
add_service
call.Proposal
Not really :(
The text was updated successfully, but these errors were encountered: