diff --git a/src/Messaging/MessagingStream.cs b/src/Messaging/MessagingStream.cs index 750afde9..56789d29 100644 --- a/src/Messaging/MessagingStream.cs +++ b/src/Messaging/MessagingStream.cs @@ -17,9 +17,15 @@ internal class MessagingStream private readonly AsyncDuplexStreamingCall _call; private readonly SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(initialCount: 1, maxCount: 1); - internal MessagingStream(string host, int port) + internal MessagingStream(string host, int port, int maxMessageLength) { - Channel channel = new Channel(host, port, ChannelCredentials.Insecure); + var channelOptions = new [] + { + new ChannelOption(ChannelOptions.MaxReceiveMessageLength, maxMessageLength), + new ChannelOption(ChannelOptions.MaxSendMessageLength, maxMessageLength) + }; + + Channel channel = new Channel(host, port, ChannelCredentials.Insecure, channelOptions); _call = new FunctionRpc.FunctionRpcClient(channel).EventStream(); } diff --git a/src/Worker.cs b/src/Worker.cs index df081af5..fa20d1f7 100644 --- a/src/Worker.cs +++ b/src/Worker.cs @@ -35,7 +35,7 @@ public async static Task Main(string[] args) .WithParsed(ops => arguments = ops) .WithNotParsed(err => Environment.Exit(1)); - var msgStream = new MessagingStream(arguments.Host, arguments.Port); + var msgStream = new MessagingStream(arguments.Host, arguments.Port, arguments.MaxMessageLength); var requestProcessor = new RequestProcessor(msgStream); // Send StartStream message