NICWebApi.Extensions.Messaging 1.0.41

dotnet add package NICWebApi.Extensions.Messaging --version 1.0.41
                    
NuGet\Install-Package NICWebApi.Extensions.Messaging -Version 1.0.41
                    
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="NICWebApi.Extensions.Messaging" Version="1.0.41" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NICWebApi.Extensions.Messaging" Version="1.0.41" />
                    
Directory.Packages.props
<PackageReference Include="NICWebApi.Extensions.Messaging" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NICWebApi.Extensions.Messaging --version 1.0.41
                    
#r "nuget: NICWebApi.Extensions.Messaging, 1.0.41"
                    
#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.
#:package NICWebApi.Extensions.Messaging@1.0.41
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NICWebApi.Extensions.Messaging&version=1.0.41
                    
Install as a Cake Addin
#tool nuget:?package=NICWebApi.Extensions.Messaging&version=1.0.41
                    
Install as a Cake Tool

NICWebApi.Extensions.Messaging

消息队列扩展包。默认提供内存队列,适合开发环境、单体应用和轻量异步解耦;需要多实例共享轻量队列时可显式启用 Redis。

使用

builder.Services.AddMessaging();
builder.Services.AddScoped<IMessageHandler<OrderCreated>, OrderCreatedHandler>();

await publisher.PublishAsync(new OrderCreated(orderId));

处理器:

public sealed class OrderCreatedHandler : IMessageHandler<OrderCreated>
{
    public Task HandleAsync(OrderCreated message, CancellationToken cancellationToken = default)
    {
        return Task.CompletedTask;
    }
}

配置

{
  "Messaging": {
    "Capacity": 1000,
    "ConsumerCount": 1,
    "MaxRetryCount": 3,
    "Redis": {
      "Enabled": false,
      "Configuration": "localhost:6379",
      "QueueKey": "nicwebapi:messaging:queue",
      "PollInterval": "00:00:01"
    }
  }
}

代码开启 Redis:

builder.Services.AddMessaging(options => options.UseRedis("localhost:6379", "my-api:queue"));

默认内存队列不持久化。当前 Redis 实现使用列表队列,适合轻量多实例消费;跨服务可靠消息、死信补偿和事件追踪仍建议接入公司统一 MQ。

更多内容:

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NICWebApi.Extensions.Messaging:

Package Downloads
NICWebApi.Extensions.AspNetCore

NICWebApi ASP.NET Core 一键集成扩展包,组合 DynamicAPI、RESTfulResult、JWT、Mapper、DependencyInjection、Http、RemoteRequest、Caching、Idempotency、Schedule、Messaging 和 OperationLogging 的默认注册。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.41 140 7/7/2026