Devplus.Messaging 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Devplus.Messaging --version 2.2.0
                    
NuGet\Install-Package Devplus.Messaging -Version 2.2.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="Devplus.Messaging" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Devplus.Messaging" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Devplus.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 Devplus.Messaging --version 2.2.0
                    
#r "nuget: Devplus.Messaging, 2.2.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.
#:package Devplus.Messaging@2.2.0
                    
#: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=Devplus.Messaging&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Devplus.Messaging&version=2.2.0
                    
Install as a Cake Tool

Devplus.Messaging 📬

NuGet Downloads

📬 Biblioteca para integração com RabbitMQ e mensageria.


🚀 Instalação

Para instalar a biblioteca via NuGet, utilize o seguinte comando:

dotnet add package Devplus.Messaging

Ou, no Visual Studio:

  1. Abra o Gerenciador de Pacotes NuGet.
  2. Busque por Devplus.Messaging.
  3. Clique em Instalar.

⚡ Como Usar

📦 Publicando Mensagens

using Devplus.Messaging.Interfaces;

    private readonly IMessagingPublisher _messagingPublisher;
    public TestMessageService(IMessagingPublisher messagingProducer)
    {
        _messagingPublisher = messagingProducer;
    }
    public async Task SendMessage()
    {
        await _messagingPublisher.PublishAsync(exchangeName: "devplus-test-exchange",
                                                message: "{responseData: \"Test message from TestMessageService\"}",
                                                source: "devplus.test.app",
                                                typeEvent: "test-event");
    }

📩 Consumindo Mensagens

using Devplus.Messaging.Interfaces;
using Devplus.Messaging.Models;

namespace Devplus.TestApp.Consumers;
public class TestConsumer : IMessagingConsumer
{
    public string QueueName => "devplus-test-queue";
    public string ExchangeName => "devplus-test-exchange";
    public string RoutingKey => "";
    public int MaxRetry => 3;

    private readonly ILogger<TestConsumer> _logger;

    public TestConsumer(ILogger<TestConsumer> logger)
    {
        _logger = logger;
    }

    public Task ConsumeAsync(CloudEvent<object> cloudEvent, CancellationToken cancellationToken)
    {
        _logger.LogInformation("Received message: {Message}", cloudEvent.Data);
        return Task.CompletedTask;
    }
}

QueueName e ExchangeName são obrigatórios para a lib realizar o bind no RabbitMq. MaxRetry configura o numero máximo de tentativas que a menssagem é processada até ser enviada para DLQ.


🔧 Configuração via appsettings.json

{
  "RabbitMq": {
    "Host": "localhost",
    "Port": "5672",
    "Username": "user",
    "Password": "pass",
    "VHost": "my_vhost"
  }
}

E no Program.cs:

var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();

builder.Services.AddMessaging(builder.Configuration);
builder.Services.AddScoped<ITestMessageService, TestMessageService>();
builder.Services.AddScoped<IMessagingConsumer, TestConsumer>();
builder.Services.AddScoped<TestConsumer>();


🛠 Compatibilidade

.NET Version Suportado
.NET 8.0 ✅ Sim
.NET 7.0 ✅ Sim
.NET 6.0 ✅ Sim
.NET Core 3.1 ⚠️ Suporte limitado
.NET Framework ❌ Não suportado

📌 Funcionalidades

✅ Suporte ao RabbitMQ com publicação e consumo de mensagens.
Injeção de dependência via IServiceCollection.
Configuração via appsettings.json.
✅ Compatível com .NET 6, .NET 7 e .NET 8.


🏗 Contribuindo

Se você quiser contribuir para este projeto:

  1. Fork o repositório.
  2. Crie uma branch (git checkout -b feature/nova-feature).
  3. Faça commit das alterações (git commit -m "Add nova feature").
  4. Envie um Pull Request.

📄 Licença

Este projeto está licenciado sob a MIT License.


📞 Contato

📧 Email: clayton@devplus.com.br
🔗 LinkedIn: Clayton Oliveira
🚀 Devplus Consultoria: www.devplus.com.br

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 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.1 411 10/14/2025
2.7.5 189 9/29/2025
2.7.4 2,094 5/20/2025
2.7.2 187 5/17/2025
2.7.0 262 4/30/2025
2.6.1 225 4/29/2025
2.5.1 273 4/23/2025
2.5.0 306 4/14/2025
2.4.1 232 4/8/2025
2.4.0 239 4/8/2025
2.2.0 241 4/7/2025
2.1.0 223 4/6/2025
2.0.0 518 3/25/2025
1.0.2 334 3/23/2025
1.0.1 223 3/20/2025
1.0.0 234 3/19/2025