Aj.RabbitMQ.Core
1.0.1
See the version list below for details.
dotnet tool install --global Aj.RabbitMQ.Core --version 1.0.1
dotnet new tool-manifest
dotnet tool install --local Aj.RabbitMQ.Core --version 1.0.1
#tool dotnet:?package=Aj.RabbitMQ.Core&version=1.0.1
nuke :add-package Aj.RabbitMQ.Core --version 1.0.1
Aj.RabbitMQ.Core
🚀 Biblioteca .NET para abstração de mensageria no RabbitMQ, totalmente extensível, orientada a microsserviços e multi-tenant.
✨ Recursos
✅ Conexão centralizada (singleton)
✅ Configuração via IConfiguration
e DataAnnotations
✅ Declaração de exchanges, filas, bindings padronizados
✅ Suporte a prefetch (QoS)
✅ Envelope de mensagens estruturado (MessageEnvelope
)
✅ Retry e DLQ integrado (padrão de robustez)
✅ Helpers para exchanges direct
, topic
, fanout
✅ Extensões para injeção no IServiceCollection
📦 Instalação
no seu projeto:
dotnet add package Aj.RabbitMQ.Core
⚙️ Configuração
adicione ao seu appsettings.json
:
"RabbitMQSettings": {
"HostName": "localhost",
"UserName": "admin",
"Password": "123456",
"VirtualHost": "/",
"Port": 5672,
"TenantId": "tenant1"
}
OBS: A Propriedade "TenantId" so deve ser informada caso a fila precise ser exclusiva do Client.
e registre no Program.cs
:
builder.Services.AddRabbitMQServices(builder.Configuration);
🚀 Uso Básico
var connectionFactory = serviceProvider.GetRequiredService<RabbitMQConnectionFactory>();
var channel = await connectionFactory.GetChannelAsync();
🟦 Retry + DLQ
por padrão, sugerimos:
- fila normal
- fila
.retry
comx-message-ttl
- fila
.dlq
para mensagens definitivas - exchanges:
direct.order
direct.retry
direct.dlq
📚 Exemplos avançados
declarar exchange
await _channel.ExchangeDeclareAsync(
exchange: "direct.order",
type: "direct",
durable: true,
autoDelete: false
);
declarar fila com TTL + DLQ
await _channel.QueueDeclareAsync(
queue: "order.billing.retry",
durable: true,
exclusive: false,
autoDelete: false,
arguments: new Dictionary<string, object>
{
{ "x-message-ttl", 300000 },
{ "x-dead-letter-exchange", "direct.order" },
{ "x-dead-letter-routing-key", "order.created" }
}
);
✅ Checklist de Qualidade
- Multi-tenant
- Extensível
- Segue princípios SOLID
- Fácil integração com MediatR e Polly
- Suporte ao plugin management do RabbitMQ
👨💻 Contribuições
Pull Requests são muito bem-vindos!
Basta abrir uma issue ou PR neste repositório.
📄 Licença
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
This package has no dependencies.
Versão inicial do Aj.RabbitMQ.Core com suporte a exchanges, filas, retry e dead-letter queues.