-
Notifications
You must be signed in to change notification settings - Fork 360
Description
Hey,
we use protobuf.net-Grpc for code-first gRPC services. In its current form, this relies on DaprClient.CreateInvocationInvoker to create a CallInvoker which is then used to create the gRPC service client.
That looks for example like this and works fine:
var client = DaprClient
.CreateInvocationInvoker("demo-server")
.CreateGrpcService<IExampleService>();The problem now comes when wanting to use GrpcChannelOptions, e.g. to change the maximum request/response sizes. The usual way in Dapr is to configure the channel options with the DaprClientBuilder:
// manual client creation
var daprClient = new DaprClientBuilder()
.UseGrpcChannelOptions(new GrpcChannelOptions { MaxReceiveMessageSize = 16 * 1024 * 1024 })
.Build();
// or when using Dapr.AspNetCore
builder.Services.AddDaprClient(builder =>
{
builder.UseGrpcChannelOptions(new GrpcChannelOptions { MaxReceiveMessageSize = 16 * 1024 * 1024 })
});However, this configuration is only used when using the DaprClientBuilder to create a DaprClient. This however is not useful when using other means of creating a client, e.g. code-first servies with protobuf.net-Grpc.
So right now, there is no way to pass in GrpcChannelOptions when using CreateInvocationInvoker. The method creates the channel using GrpcChannel.ForAddress without passing any channel options which means the default channel options will always be used.
Suggestion
I would propose to add an overload to CreateInvocationInvoker which takes a GrpcChannelOptions object that is then used when creating the channel.
Additional details
My current (working) workaround copies the CreateInvocationInvoker method and the internal methods from DaprDefaults. So this is already working in our setup.
I also have this change ready in my fork, if you accept this feature request.
Release Note
ADD Ability to configure the gRPC channel options when using CreateInvocationInvoker