This is an automated email from the ASF dual-hosted git repository.
aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new 14c609de Disable auto retry of gRPC
14c609de is described below
commit 14c609dea0459b3d51517008f413edb307c86080
Author: Aaron Ai <[email protected]>
AuthorDate: Thu Mar 16 16:05:10 2023 +0800
Disable auto retry of gRPC
---
csharp/README-CN.md | 2 +-
csharp/rocketmq-client-csharp/RpcClient.cs | 8 ++------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/csharp/README-CN.md b/csharp/README-CN.md
index 6c520489..dcc6a63a 100644
--- a/csharp/README-CN.md
+++ b/csharp/README-CN.md
@@ -6,7 +6,7 @@
支持.NET 5+ 和 .NET Core 3.1。
-由于.NET 5 在 2020 年的发布,统一了.NET Framework 和 .NET Core ,并逐渐成为 .NET
开发的主流平台。我们强烈推荐使用.NET
+由于.NET 5 在 2020 年的发布,统一了.NET Framework 和 .NET Core ,并逐渐成为 .NET
开发的主流平台。我们强烈推荐使用 .NET
5 访问 RocketMQ,但是与此同时我们也支持使用 .NET Core 3.1。如果您想使用 .NET Core 3.1 接入
RocketMQ,请在运行之前添加以下代码。
```csharp
diff --git a/csharp/rocketmq-client-csharp/RpcClient.cs
b/csharp/rocketmq-client-csharp/RpcClient.cs
index b8a02430..d5c24d7f 100644
--- a/csharp/rocketmq-client-csharp/RpcClient.cs
+++ b/csharp/rocketmq-client-csharp/RpcClient.cs
@@ -20,7 +20,6 @@ using System.Collections.Generic;
using System.Net.Http;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
-using System.Threading;
using System.Threading.Tasks;
using Proto = Apache.Rocketmq.V2;
using Grpc.Core;
@@ -43,6 +42,8 @@ namespace Org.Apache.Rocketmq
_channel = GrpcChannel.ForAddress(_target, new GrpcChannelOptions
{
HttpHandler = CreateHttpHandler(),
+ // Disable auto-retry.
+ MaxRetryAttempts = 0
});
var invoker = _channel.Intercept(new ClientLoggerInterceptor());
_stub = new
Proto::MessagingService.MessagingServiceClient(invoker);
@@ -63,13 +64,8 @@ namespace Org.Apache.Rocketmq
return true;
}
- /**
- * See
https://docs.microsoft.com/en-us/aspnet/core/grpc/performance?view=aspnetcore-6.0
for performance consideration and
- * why parameters are configured this way.
- */
internal static HttpMessageHandler CreateHttpHandler()
{
- // TODO
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = CertValidator,