Zyx.MemoryMQ 1.0.7

dotnet add package Zyx.MemoryMQ --version 1.0.7
                    
NuGet\Install-Package Zyx.MemoryMQ -Version 1.0.7
                    
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="Zyx.MemoryMQ" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zyx.MemoryMQ" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="Zyx.MemoryMQ" />
                    
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 Zyx.MemoryMQ --version 1.0.7
                    
#r "nuget: Zyx.MemoryMQ, 1.0.7"
                    
#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 Zyx.MemoryMQ@1.0.7
                    
#: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=Zyx.MemoryMQ&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=Zyx.MemoryMQ&version=1.0.7
                    
Install as a Cake Tool

用法

  • 首先在Services上配置 AddMemoryMQ()
  • 然后在中间件中使用 UseMemoryMQ()
  • 在要接受处理消息的地方 继承IBus<> 接口
  • 在要用到发布消息的地方 先将 IProducer 注入到构造函数中 使用 PublishAsync() 方法发布到消息队列中 消息队列根据 IBus<> 的 topic 进行消息分发(使用多线程同时处理) 发布和接受类型不一致时会提示错误
builder.Services.AddMemoryMQ();
app.UseMemoryMQ();
// 支持构造函数注入
// 当要订阅多个topic时 使用Subscribe特性
public class TestBus : IBus<Test>
{
  public string topic => "123/456";

  private readonly ILogger<TestBus> logger;

  public TestBus(ILogger<TestBus> logger)
  {
    this.logger = logger;
  }

  [Subscribe("123")]
  public Task HandlerAsync(Test data)
  {
    logger.LogInformation("我是TestBus:  " + data.Name);
    return Task.CompletedTask;
  }
}

public class Test
{
  public string Name { get; set; }
}
// 构造函数注入 IProducer 对象
await producer.PublishAsync("123/456",new Test(){Name = name});
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.  net10.0 was computed.  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 Zyx.MemoryMQ:

Package Downloads
Lofty.Framework.Core

Core 基础组件

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Zyx.MemoryMQ:

Repository Stars
hzy-6/hzy-admin
前后端分离权限管理系统基架! 数据权限、按钮权限、动态菜单、动态任务调度、动态WebApi、定时标记 [Scheduled("0/5 * * * * ?")] 、代码生成
Version Downloads Last Updated
1.0.7 9,277 1/21/2024
1.0.6 3,190 2/16/2023
1.0.5 304 2/16/2023
1.0.4 589 11/14/2022
1.0.3 905 7/15/2022
1.0.2 496 7/11/2022
1.0.1 513 7/8/2022
1.0.0 523 7/7/2022