EasilyNET.RabbitBus.AspNetCore 1.9.0-preview2

This is a prerelease version of EasilyNET.RabbitBus.AspNetCore.
There is a newer version of this package available.
See the version list below for details.
dotnet add package EasilyNET.RabbitBus.AspNetCore --version 1.9.0-preview2                
NuGet\Install-Package EasilyNET.RabbitBus.AspNetCore -Version 1.9.0-preview2                
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="EasilyNET.RabbitBus.AspNetCore" Version="1.9.0-preview2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasilyNET.RabbitBus.AspNetCore --version 1.9.0-preview2                
#r "nuget: EasilyNET.RabbitBus.AspNetCore, 1.9.0-preview2"                
#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 EasilyNET.RabbitBus.AspNetCore as a Cake Addin
#addin nuget:?package=EasilyNET.RabbitBus.AspNetCore&version=1.9.0-preview2&prerelease

// Install EasilyNET.RabbitBus.AspNetCore as a Cake Tool
#tool nuget:?package=EasilyNET.RabbitBus.AspNetCore&version=1.9.0-preview2&prerelease                
EasilyNET.RabbitBus.AspNetCore
如何使用
  • 首先使用 Nuget 包管理工具添加依赖 EasilyNET.RabbitBus.AspNetCore
  • 等待下载完成和同意开源协议后,即可使用本库.
  • Step1.在 Program.cs 中配置消息总线
// 配置服务(亦可使用集群模式或者使用配置文件)
builder.Services.AddRabbitBus(c =>
{
    c.Host = "192.168.2.110";
    c.Port = 5672;
    c.UserName = "username";
    c.PassWord = "password";
    ...
});

// 注册服务
builder.Services.AddTransient<TestEventHandler>();
  • Step2.接下来配置事件和事件处理器
/// <summary>
/// 测试消息类型
/// </summary>
[Rabbit("hoyo.test", EExchange.Routing, "test", "orderqueue2")]
public class TestEvent : IntegrationEvent
{
    /// <summary>
    /// 消息
    /// </summary>
    public string Message { get; set; } = default!;
}

/// <summary>
/// 消息处理Handler
/// </summary>
public class TestEventHandler : IIntegrationEventHandler<TestEvent>
{
    private readonly ILogger<TestEventHandler> _logger;
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="logger"></param>
    public TestEventHandler(ILogger<TestEventHandler> logger)
    {
        _logger = logger;
    }
    /// <summary>
    /// 当消息到达的时候执行的Action
    /// </summary>
    /// <param name="event"></param>
    /// <returns></returns>
    public Task HandleAsync(TestEvent @event)
    {
        _logger.LogInformation("TestEvent_{event}-----{date}", @event.Message, DateTime.Now);
        return Task.CompletedTask;
    }
}
  • Step3.使用消息队列发送消息
private readonly IIntegrationEventBus _ibus;
// 控制器构造函数伪代码
construct(IIntegrationEventBus ibus){
   _ibus = ibus;
}
/// <summary>
/// 创建一个延时消息,同时发送一个普通消息做对比
/// </summary>
[HttpPost("TTLTest")]
public void TTLTest()
{
    var rand = new Random();
    var ttl = rand.Next(1000, 10000);
    var ttlobj = new DelayedMessageEvent() { Message = $"延迟{ttl}毫秒,当前时间{DateTime.Now:yyyy-MM-dd HH:mm:ss}" };
    // 延时队列需要服务端安装延时队列插件.
    _ibus.Publish(ttlobj, (uint)ttl);
    _ibus.Publish(ttlobj);
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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
4.25.116.110 33 1/16/2025
4.25.115.121 9 1/15/2025
4.25.114.172 29 1/14/2025
4.25.109.111 48 1/9/2025
4.25.108.182 55 1/8/2025
4.25.108.160 54 1/8/2025
4.25.1.1 97 1/1/2025
3.24.1224.141 82 12/24/2024
3.24.1216.116 91 12/16/2024
3.24.1206.100 61 12/6/2024
3.24.1205.171 67 12/5/2024
3.24.1202.150 62 12/2/2024
3.24.1126.231 66 11/26/2024
3.24.1126.172 61 11/26/2024
3.24.1126.114 60 11/26/2024
3.24.1126.104 60 11/26/2024
3.24.1125.181 49 11/25/2024
3.24.1125.104 60 11/25/2024
3.24.1121.183 57 11/21/2024
3.24.1120.183 55 11/20/2024
3.24.1119.31 57 11/18/2024
3.24.1115.143 46 11/15/2024
3.24.1113.100 60 11/13/2024
3.24.1112.125 201 11/12/2024
3.24.1107.140 55 11/7/2024
3.24.1107.54 55 11/7/2024
3.24.1107.34 57 11/7/2024
3.24.1105.111 61 11/5/2024
3.24.1103.31 65 11/2/2024
3.24.1103 61 11/2/2024
3.24.1031.135 51 10/31/2024
3.24.1031.112 53 10/31/2024
3.24.1031.104 53 10/31/2024
3.24.1029.142 59 10/29/2024
3.24.1025.30 154 10/24/2024
3.24.1022.142 49 10/22/2024
3.24.1018.204 111 10/18/2024
3.24.1018.175 106 10/18/2024
3.24.1018.166 105 10/18/2024
3.24.1018.93 108 10/18/2024
3.24.1017.42 58 10/16/2024
3.24.1016.161 60 10/16/2024
3.24.1015.231 60 10/15/2024
3.24.1015.14 60 10/14/2024
3.24.1012.114 56 10/12/2024
3.24.1009.115 59 10/9/2024
3.24.1008.160 59 10/8/2024
3.24.1008.133 55 10/8/2024
3.24.1007.185 58 10/7/2024
3.24.1003.33 64 10/2/2024
3.24.1002.162 61 10/2/2024
3.24.929.143 59 9/29/2024
3.24.929.141 55 9/29/2024
3.24.929.131 57 9/29/2024
3.24.929.122 61 9/29/2024
3.24.926.184 61 9/26/2024
3.24.926.182 61 9/26/2024
3.24.926.175 64 9/26/2024
3.24.924.160 60 9/24/2024
3.24.924.133 71 9/24/2024
3.24.924.124 60 9/24/2024
3.24.924.10 64 9/23/2024
3.24.924.1 54 9/23/2024
3.24.923.234 58 9/23/2024
3.24.923.232 64 9/23/2024
3.24.923.155 59 9/23/2024
3.24.919.92 72 9/19/2024
3.24.914.125 69 9/14/2024
3.24.914.115 65 9/14/2024
3.24.914.111 65 9/14/2024
3.24.911.95 66 9/11/2024
3.24.908.215 58 9/8/2024
3.24.904.200 66 9/4/2024
3.24.828.163 70 8/28/2024
3.24.820.173 74 8/20/2024
3.24.814.92 82 8/14/2024
3.24.812.115 74 8/12/2024
3.24.802.100 54 8/2/2024
3.24.801.162 60 8/1/2024
3.24.801.160 62 8/1/2024
3.24.801.155 60 8/1/2024
3.24.730.164 49 7/30/2024
3.24.730.91 47 7/30/2024
3.24.724.91 56 7/24/2024
3.24.718.105 79 7/18/2024
3.24.716.95 68 7/16/2024
3.24.712.94 63 7/12/2024
3.24.710.14 64 7/9/2024
3.24.709.105 71 7/9/2024
3.24.704.94 64 7/4/2024
3.24.701.90 62 7/1/2024
3.24.628.114 71 6/28/2024
3.24.627.145 64 6/27/2024
3.24.620.160 72 6/20/2024
3.24.613.115 68 6/13/2024
3.24.612.95 73 6/12/2024
3.24.528.90 68 5/28/2024
3.24.522.84 84 5/22/2024
3.24.512.213 65 5/12/2024
3.24.508.112 84 5/8/2024
2.2024.428.71 77 4/28/2024
2.2024.427.1128 79 4/27/2024
2.2.72 87 4/14/2024
2.2.71 68 4/12/2024
2.2.8 72 4/26/2024
2.2.6 68 4/10/2024
2.2.5 88 3/26/2024
2.2.4 87 3/25/2024
2.2.3 77 3/24/2024
2.2.2 81 3/21/2024
2.2.1 83 3/20/2024
2.2.0 89 3/13/2024
2.1.9 81 2/21/2024
2.1.8 82 2/18/2024
2.1.7 87 2/16/2024
2.1.6 100 2/14/2024
2.1.5 77 2/14/2024
2.1.4 102 2/9/2024
2.1.3 80 2/8/2024
2.1.2 110 2/5/2024
2.1.1.2 159 12/26/2023
2.1.1.1 95 12/26/2023
2.1.1 95 12/25/2023
2.1.0 111 12/17/2023
2.0.11 144 12/6/2023
2.0.1 139 11/15/2023
2.0.0 95 11/14/2023
1.9.1 112 11/1/2023
1.9.0 105 10/19/2023
1.9.0-preview2 210 10/12/2023
1.9.0-preview1 83 10/12/2023
1.8.9 131 10/11/2023
1.8.8 125 10/11/2023
1.8.7-rc2 89 9/21/2023
1.8.7-rc1 85 9/12/2023
1.8.6 125 8/31/2023
1.8.5 544 8/25/2023
1.8.4 115 8/24/2023
1.8.3 111 8/23/2023
1.8.2 155 8/22/2023
1.8.1 115 8/18/2023
1.8.0 116 8/15/2023
1.7.9 140 8/11/2023
1.7.8 113 8/11/2023
1.7.7 126 8/10/2023
1.7.6 122 8/9/2023
1.7.5 144 8/9/2023
1.7.4 162 8/3/2023
1.7.3 129 8/1/2023
1.7.2 127 7/31/2023
1.7.1 121 7/27/2023
1.7.0 127 7/25/2023
1.6.9 128 7/25/2023
1.6.8 118 7/24/2023
1.6.7 132 7/20/2023
1.6.6 126 7/19/2023
1.6.5 96 7/19/2023
1.6.4 118 7/17/2023
1.6.3 114 7/17/2023
1.6.2 133 7/12/2023
1.6.1 132 6/30/2023
1.6.0 112 6/30/2023