Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jinzaz/jinzaz.cap.mqtt
dotnetcore/CAP的MQTT扩展支持
https://github.com/jinzaz/jinzaz.cap.mqtt
aspnetcore cap dotnetcore mqtt
Last synced: 27 days ago
JSON representation
dotnetcore/CAP的MQTT扩展支持
- Host: GitHub
- URL: https://github.com/jinzaz/jinzaz.cap.mqtt
- Owner: jinzaz
- License: mit
- Created: 2022-11-22T05:39:26.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T02:38:11.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T08:18:24.998Z (3 months ago)
- Topics: aspnetcore, cap, dotnetcore, mqtt
- Language: C#
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jinzaz.CAP.MQTT
dotnetcore/CAP的MQTT扩展支持 ![Nuget](https://img.shields.io/nuget/v/jinzaz.CAP.MQTT) ![GitHub](https://img.shields.io/github/license/jinzaz/jinzaz.CAP.MQTT?color=blue) ![Nuget](https://img.shields.io/nuget/dt/jinzaz.CAP.MQTT?color=blue) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/jinzaz/jinzaz.CAP.MQTT)```
// select a transport provider you are using, event log table will integrate into.PM> Install-Package jinzaz.CAP.MQTT
```### Configuration
#### .Net Core
```cs
public void ConfigureServices(IServiceCollection services)
{
//......services.AddDbContext(); //Options, If you are using EF as the ORM
services.AddCap(x =>
{
x.UseEntityFramework();
x.UseMQTT(options => {
options.Server = "localhost";
options.Port = 6000;
options.UserName = "admin";
options.Password = "password";
options.ClientId = "z5fas51fs";
});
x.UseDashboard();
x.FailedRetryCount = 5;
x.FailedThresholdCallback = failed =>
{
var logger = failed.ServiceProvider.GetService>();
logger.LogError($@"A message of type {failed.MessageType} failed after executing {x.FailedRetryCount} several times,
requiring manual troubleshooting. Message name: {failed.Message.GetName()}");
};
});
}```
#### .Net 6、7
```cs
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);builder.Services.AddDbContext(); //Options, If you are using EF as the ORM
// Add services to the container.
builder.Services.AddCap(x => {
x.UseEntityFramework();
x.UseMQTT(options => {
options.Server = "localhost";
options.Port = 6000;
options.UserName = "admin";
options.Password = "password";
options.ClientId = "z5fas51fs";
});
x.UseDashboard();
x.FailedRetryCount = 5;
x.FailedThresholdCallback = failed =>
{
var logger = failed.ServiceProvider.GetService>();
logger.LogError($@"A message of type {failed.MessageType} failed after executing {x.FailedRetryCount} several times,
requiring manual troubleshooting. Message name: {failed.Message.GetName()}");
};
});
builder.Services.AddControllers();var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseAuthorization();
app.MapControllers();
app.Run();
}
```