Skip to content
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

use_grpc does not work with multiples services #304

Open
joshuapassos opened this issue May 17, 2021 · 1 comment · May be fixed by #317
Open

use_grpc does not work with multiples services #304

joshuapassos opened this issue May 17, 2021 · 1 comment · May be fixed by #317

Comments

@joshuapassos
Copy link

joshuapassos commented May 17, 2021

Based from sample here

Add someone new service

let app = application {
  no_router
  listen_local 10042 (fun opts -> opts.Protocols <- HttpProtocols.Http2)
  use_grpc Service1
  use_grpc Service2
}

Only Service2 works

@joshuapassos
Copy link
Author

joshuapassos commented May 17, 2021

To workaround, I created a new grpc to use interceptors and multiples services

type Saturn.Application.ApplicationBuilder with
    [<CustomOperation("grpc")>]
    member __.UseCustomGrpc(state) =
        let configureServices (services: IServiceCollection) =
            // services.AddGrpc(fun opt -> opt.Interceptors.Add<InterceptorTest>()) |> ignore
            services.AddGrpc() |> ignore
            services

        let configureApp (app: IApplicationBuilder) =
            app.UseRouting()

        let configureGrpcEndpoint (app: IApplicationBuilder) =
            app.UseEndpoints (fun endpoints -> endpoints.MapGrpcService<Service1>() |> ignore) |> ignore
            app.UseEndpoints (fun endpoints -> endpoints.MapGrpcService<Service2>() |> ignore) |> ignore
            app.UseEndpoints (fun endpoints -> endpoints.MapGrpcService<Service3>() |> ignore) |> ignore
            app

        { state with
            AppConfigs = configureApp::configureGrpcEndpoint::state.AppConfigs
            ServicesConfig = configureServices::state.ServicesConfig
        }
let app = application {
  no_router
  listen_local 10042 (fun opts -> opts.Protocols <- HttpProtocols.Http2)
  grpc
}

@joshuapassos joshuapassos linked a pull request Sep 26, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant