Zyx.MemoryMQ
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Zyx.MemoryMQ --version 1.0.0
NuGet\Install-Package Zyx.MemoryMQ -Version 1.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="Zyx.MemoryMQ" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zyx.MemoryMQ --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zyx.MemoryMQ, 1.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 Zyx.MemoryMQ as a Cake Addin #addin nuget:?package=Zyx.MemoryMQ&version=1.0.0 // Install Zyx.MemoryMQ as a Cake Tool #tool nuget:?package=Zyx.MemoryMQ&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
用法
- 首先在Services上配置 AddMemoryMQ()
- 然后在中间件中使用 UseMemoryMQ()
- 在要接受处理消息的地方 继承IBus<> 接口
- 在要用到发布消息的地方 先将 IProducer 注入到构造函数中 使用 PublishAsync() 方法发布到消息队列中 消息队列根据 IBus<> 的 topic 进行消息分发 发布和接受类型不一致时会提示错误
builder.Services.AddMemoryMQ();
app.UseMemoryMQ();
public class TestBus : IBus<Test>
{
public string topic => "123/456";
public Task HandlerAsync(Test data)
{
Console.WriteLine("我是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 | Versions 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 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.
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyModel (>= 6.0.0)
- System.Threading.Channels (>= 6.0.0)
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 * * * * ?")] 、代码生成
|