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
commit 8efac8660fc19bbd2a19593aaba54cf84dc19ee5 Author: Aaron Ai <[email protected]> AuthorDate: Thu Mar 16 14:48:37 2023 +0800 Add more docs --- csharp/README-CN.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ csharp/README.md | 24 +++++++++++++++------ 2 files changed, 79 insertions(+), 7 deletions(-) diff --git a/csharp/README-CN.md b/csharp/README-CN.md new file mode 100644 index 00000000..6c520489 --- /dev/null +++ b/csharp/README-CN.md @@ -0,0 +1,62 @@ +# .NET 客户端 + +[English](README.md) | 简体中文 | [RocketMQ 官网](https://rocketmq.apache.org/) + +## 最小版本支持 + +支持.NET 5+ 和 .NET Core 3.1。 + +由于.NET 5 在 2020 年的发布,统一了.NET Framework 和 .NET Core ,并逐渐成为 .NET 开发的主流平台。我们强烈推荐使用.NET +5 访问 RocketMQ,但是与此同时我们也支持使用 .NET Core 3.1。如果您想使用 .NET Core 3.1 接入 RocketMQ,请在运行之前添加以下代码。 + +```csharp +AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true) +``` + +关于 .NET 5 的更多介绍,可以参照 [Introducing .NET 5](https://devblogs.microsoft.com/dotnet/introducing-net-5/)。 + +## 概述 + +当前客户端基于 [rocketmq-apis](https://github.com/apache/rocketmq-apis) +中的协议约束和 [gRPC-dotnet](https://github.com/grpc/grpc-dotnet) 进行构建,使用 Protocol Buffers 作为序列化协议。 + +## 快速开始 + +使用下面的命令来将客户端添加到你项目的依赖中: + +```sh +dotnet add package RocketMQ.Client +``` + +你可以从 [Nuget Gallery](https://www.nuget.org/packages/RocketMQ.Client) 从获取最新的 `RocketMQ.Client` +版本,我们提供了[代码示例](./examples)来帮助你快速开始。 + +## 构建 + +本项目的布局大致遵循[此处的指南](https://docs.microsoft.com/en-us/dotnet/core/tutorials/library-with-visual-studio-code?pivots=dotnet-5-0) +,解决方案内包含客户端类库,单元测试模块和示例代码模块。假设你处于当前项目的路径下: + +```sh +# 构建项目 +dotnet build +# 运行单元测试 +dotnet test -l "console;verbosity=detailed" +``` + +## 日志系统 + +我们使用 [NLog](https://nlog-project.org/) 作为日志实现,与 Java 客户端类似,我们允许使用环境来自定义日志相关的配置。 + +* `rocketmq_log_level`:日志输出级别,默认为INFO。 +* `rocketmq_log_root` + :日志输出的根目录。默认路径为 `$HOME/logs/rocketmq`,因此完整路径为 `$HOME/logs/rocketmq/rocketmq-client.log`。 +* `rocketmq_log_file_maxIndex`:要保留的日志文件的最大数量。默认值为 10,单个日志文件的大小限制为 64 MB。暂不支持调整。 + +除此之外,通过将 `mq_consoleAppender_enabled` 设置为 true,您可以同时将客户端日志输出到控制台进行调试。 + +## NuGet 包发布步骤 + +1. 打开命令行,进入 csharp 文件夹。 +2. 执行 `dotnet pack --configuration Release` 命令. 这会创建对应的 NuGet 包到 `bin/Release` 文件夹; +3. 登录 NuGet Gallery 并登录,点击 `Upload` 按钮并将 nupkg 文件拖入提示框; +4. 按照 NuGet Gallery 的提示,完成后续步骤。 diff --git a/csharp/README.md b/csharp/README.md index df85a3fb..06babac7 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -1,11 +1,19 @@ # The .NET Implementation of Apache RocketMQ Client -Here is the .NET implementation of the client for [Apache RocketMQ](https://rocketmq.apache.org/). +English | [简体中文](README-CN.md) | [RocketMQ Website](https://rocketmq.apache.org/) ## Supported .NET Versions +.NET 5+ and .NET Core 3.1 is supported. + Due to the release of .NET 5 in 2020, which unified .NET Framework and .NET Core, and has gradually become the -mainstream platform for .NET development, the RocketMQ client will support .NET 5 and later versions. +mainstream platform for .NET development. We strongly recommend using .NET 5 to access RocketMQ, and we also support +accessing it using .NET Core 3.1. If you want to access it using .NET Core 3.1, please add the following code before +running it. + +```csharp +AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true) +``` See more details about .NET 5 from [Introducing .NET 5](https://devblogs.microsoft.com/dotnet/introducing-net-5/). @@ -17,6 +25,8 @@ deserialization during transmission. ## Quickstart & Build +Use the command below to add client into your dependencies. + ```sh dotnet add package RocketMQ.Client ``` @@ -42,18 +52,18 @@ dotnet test -l "console;verbosity=detailed" We use [NLog](https://nlog-project.org/) as our logging implementation. Similar to the Java binding, we allow the use of environment variables to customize the related configuration: -* `rocketmq.log.level`: Log output level, default is INFO. -* `rocketmq.log.root`: The root directory of the log output. The default path is `$HOME/logs/rocketmq`, so the full path +* `rocketmq_log_level`: Log output level, default is INFO. +* `rocketmq_log_root`: The root directory of the log output. The default path is `$HOME/logs/rocketmq`, so the full path is `$HOME/logs/rocketmq/rocketmq-client.log`. -* `rocketmq.log.file.maxIndex`: The maximum number of log files to keep. The default is 10, and the size of a single log +* `rocketmq_log_file_maxIndex`: The maximum number of log files to keep. The default is 10, and the size of a single log file is limited to 64 MB. Adjustment is not supported yet. -Specifically, by setting `mq.consoleAppender.enabled` to true, you can output client logs to the console simultaneously +Specifically, by setting `mq_consoleAppender_enabled` to true, you can output client logs to the console simultaneously if you need debugging. ## Publishing Steps -1. Open the command prompt, and change the directory to the project folder that you want to package. +1. Open the command line, and change the directory to the project folder that you want to package. 2. Run the `dotnet pack --configuration Release` command. This will create a NuGet package in the `bin/Release` folder of the project. 3. To upload the package to NuGet, go to the NuGet website and sign in. Click on the "Upload" button and select the
