LightMQ 0.1.0

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

// Install LightMQ as a Cake Tool
#tool nuget:?package=LightMQ&version=0.1.0                

LightMQ

介绍

基于数据库的消息队列,目前支持的数据库:

  1. MongoDB
  2. SqlServer

使用方式

初始化:


serviceCollection.AddLightMQ(it =>
{
    // it.UseSqlServer("Data Source=.;Initial Catalog=Test;User ID=sa;Password=Abc12345;");
    it.UseMongoDB("mongodb://localhost:27017","Test");
});

新增消费者:

public class TestConsumer:MessageConsumerBase
{
    public TestConsumer(IStorageProvider storageProvider) : base(storageProvider)
    {
    }

    public override ConsumerOptions GetOptions()
    {
        return new ConsumerOptions()
        {
            Topic = "test",
            PollInterval = TimeSpan.FromSeconds(2)
        };
    }

    public override Task ConsumeAsync(string message, CancellationToken cancellationToken)
    {
        Console.WriteLine(message);
        return Task.CompletedTask;
    }
}

注册消费者:

serviceCollection.AddHostedService<TestConsumer>();

发送消息:

[HttpPost]
public async Task<IActionResult> Publish([FromServices] IMessagePublisher messagePublisher)
{
    await messagePublisher.PublishAsync("test", "hello world");
    return Ok();
}
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 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 (4)

Showing the top 4 NuGet packages that depend on LightMQ:

Package Downloads
LightMQ.Storage.MongoDB

基于数据库的消息队列

LightMQ.Storage.SqlServer

基于数据库的消息队列

LightMQ.OpenTelemetry

基于数据库的消息队列

LightMQ.Storage.Sqlite

基于数据库的消息队列

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0-preview2 114 9/6/2024
2.1.0-preview 106 9/4/2024
2.0.3 137 8/21/2024
2.0.2 130 8/17/2024
2.0.1 133 8/17/2024
2.0.0 134 8/17/2024
1.2.0 89 7/29/2024
1.1.1 95 7/29/2024
1.1.0 177 7/6/2024
1.0.1 231 12/18/2023
1.0.0 132 12/18/2023
1.0.0-preview4 161 11/27/2023
1.0.0-preview3 96 11/27/2023
1.0.0-preview2 126 11/25/2023
1.0.0-preview 97 11/25/2023
0.4.0 203 11/4/2023
0.3.0 153 11/2/2023
0.2.3 122 11/2/2023
0.2.2 152 11/2/2023
0.2.1 164 11/2/2023
0.2.0 115 11/2/2023
0.1.1 162 10/31/2023
0.1.0 170 10/28/2023