ToolNET.AliyunRocketMQ 5.0.0

dotnet add package ToolNET.AliyunRocketMQ --version 5.0.0                
NuGet\Install-Package ToolNET.AliyunRocketMQ -Version 5.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ToolNET.AliyunRocketMQ" Version="5.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ToolNET.AliyunRocketMQ --version 5.0.0                
#r "nuget: ToolNET.AliyunRocketMQ, 5.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ToolNET.AliyunRocketMQ as a Cake Addin
#addin nuget:?package=ToolNET.AliyunRocketMQ&version=5.0.0

// Install ToolNET.AliyunRocketMQ as a Cake Tool
#tool nuget:?package=ToolNET.AliyunRocketMQ&version=5.0.0                

1.配置文件格式:

{
  "AliyunRocketMQ": {
    "AccessKeyID": "",      //AccessKey ID阿里云身份验证,在阿里云用户信息管理控制台创建。
    "AccessKeySecret": "",  //AccessKey Secret阿里云身份验证,在阿里云用户信息管理控制台创建。
    "Instances": [
      {
        "Id": "MQ_INST_1403624906394320_BX8JSxdy", //实例Id
        "Name": "test-01",                         //实例名称
        "TcpEndpoint": "",                         //tcp协议终端地址
        "HttpEndpoint": "",                        //http协议终端地址
        "HttpBatchSize": 3,                        //http协议消费者配置  一次最多消费?条 最多可设置为16条
        "HttpWaitSeconds": 3,                      //http协议消费者配置  长轮询时间?秒   最多可设置为30秒
        "LogPath": "C://log",                      //日志文件存储路径
        "MessageModel": 0,                         //tcp协议消费者配置   消费模式:0集群 1广播
        "Groups": [
          {
            "Id": "GID_test_http",   //消费组Id
            "ProtocolType": "HTTP"   //消费组协议类型: HTTP/TCP
          }
        ],
        "Topics": [ "t01", "t02", "t03" ] //实例下的topic
      }
    ]
  }
}

2.默认配置

默认配置:

文件路径 文件名称 节点名称
应用根目录 appsettings.json AliyunRocketMQ

不使用默认的配置节点或文件时,需要在程序入口调用以下扩展方法,指定配置文件:

AliyunRocketMQInjection.UseAliyunRocketMQ(this IHostBuilder builder, string fileName, string key = "", string fileDir = null);

builder.UseAliyunRocketMQ(fileName:"", key :"", fileDir:"");

3.方法调用

工具类名 说明
HttpRocketMQUtils Http协议,生产者/消费者
TcpRocketMQUtils Tcp协议,生产者/消费者

4.其他事项说明

事项 说明
tcp协议 包引入 ONSClient4CPP.lib ONSClient4CPP.dll
tcp协议 包引入 rocketmq_client_core.lib rocketmq_client_core.dll
tcp协议 环境安装 vc_redist.x64.exe
tcp协议 参考网址 https://help.aliyun.com/document_detail/29561.html
tcp协议 参考网址 https://help.aliyun.com/document_detail/29560.html
特性标记 TopicAttribute 可为实体类标记topic特性
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0 261 3/14/2022