Ebceys.RabbitMq
1.0.0
dotnet add package Ebceys.RabbitMq --version 1.0.0
NuGet\Install-Package Ebceys.RabbitMq -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="Ebceys.RabbitMq" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ebceys.RabbitMq" Version="1.0.0" />
<PackageReference Include="Ebceys.RabbitMq" />
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 Ebceys.RabbitMq --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ebceys.RabbitMq, 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.
#:package Ebceys.RabbitMq@1.0.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=Ebceys.RabbitMq&version=1.0.0
#tool nuget:?package=Ebceys.RabbitMq&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ebceys.RabbitMq
Легковесная .NET-библиотека для интеграции с RabbitMQ через готовые building blocks:
Publisherдля отправки сообщенийClientдля request/response (RPC-подобный сценарий)ControllerServerдля обработки входящих сообщений через контроллеры и middleware
Библиотека ориентирована на использование через IHostedService и IServiceCollection.
Установка
dotnet add package Ebceys.RabbitMq
Что внутри
- Fluent-конфигурация через
RabbitMQConfigurationBuilder - Готовые дефолтные реализации:
DefaultRabbitMqClientDefaultRabbitMqControllerServerDefaultJsonSerializer
- Расширения для DI и keyed DI
- Поддержка typed-сериализаторов для отдельных типов сообщений
- Middleware pipeline для controller-сервера
Минимальный запуск
using Ebceys.RabbitMq.Configuration;
using Ebceys.RabbitMq.DependencyInjection;
using RabbitMQ.Client;
var rabbitConfig = new RabbitMQConfigurationBuilder()
.AddConnectionFactory(new ConnectionFactory
{
HostName = "localhost",
UserName = "guest",
Password = "guest"
})
.AddQueueConfiguration(new QueueConfiguration("app.events")
{
RoutingKey = "app.events"
})
.AddExchangeConfiguration(new ExchangeConfiguration("app.exchange", ExchangeTypes.Topic))
.AddCallbackConfiguration(new CallbackRabbitMQConfiguration(
new QueueConfiguration("app.events.reply") { RoutingKey = "app.events.reply" },
TimeSpan.FromSeconds(5)))
.Build();
services
.AddRabbitMqClient<DefaultRabbitMqClient>(rabbitConfig)
.AddDefaultSerializerToDi()
.AddDefaultPublisherToDi()
.AddDefaultCallbackServerToDi()
.Register();
services
.AddRabbitMqControllerServer<DefaultRabbitMqControllerServer>(rabbitConfig)
.AddDefaultSerializerToDi()
.AddDefaultResponsePublisherToDi()
.Register();
Базовый пример клиента и контроллера
using Ebceys.RabbitMq.Client;
using Ebceys.RabbitMq.Client.Models;
using Ebceys.RabbitMq.Controllers;
using Ebceys.RabbitMq.Controllers.Attributes;
using Ebceys.RabbitMq.Serializers;
public sealed class BillingRabbitMqClient(
IRabbitMqPublisher publisher,
IRabbitMqMessageSerializer serializer,
IEnumerable<IRabbitMqTypedSerializer> typed,
RabbitMqClientCallbackServer callback)
: DefaultRabbitMqClient(publisher, serializer, typed, callback)
{
public Task PublishInvoiceCreatedAsync(InvoiceCreated message, CancellationToken ct = default)
{
var request = new RabbitMqRequest("billing.invoice-created");
request.AddParameter(message);
return SendMessageAsync(request, "billing.exchange", "billing.invoice-created", token: ct);
}
public Task<InvoiceStatus?> GetInvoiceStatusAsync(Guid invoiceId, CancellationToken ct = default)
{
var request = new RabbitMqRequest("billing.invoice-status");
request.AddParameter(invoiceId);
return SendRequestAsync<InvoiceStatus>(
request,
"billing.exchange",
"billing.invoice-status",
TimeSpan.FromSeconds(5),
ct);
}
}
public sealed class BillingController : RabbitMqControllerBase
{
[RabbitMqMethod("billing.invoice-status")]
public InvoiceStatus HandleStatus(Guid invoiceId)
{
return new InvoiceStatus(invoiceId, "paid");
}
}
public sealed record InvoiceCreated(Guid InvoiceId, decimal Amount);
public sealed record InvoiceStatus(Guid InvoiceId, string Status);
Документация
- Общая карта документации:
docs/README.md - Быстрый старт:
docs/guides/quick-start.md - Настройка конфигурации:
docs/guides/configuration.md - Регистрация в DI:
docs/guides/di-registration.md
Модули
docs/modules/client.mddocs/modules/configuration.mddocs/modules/controllers.mddocs/modules/dependency-injection.mddocs/modules/serializers.mddocs/modules/server.md
API и карта исходников
docs/api/public-api.mddocs/api/production-source-map.md
Совместимость
По текущей конфигурации проекта пакет собирается под net10.0.
License
Beer-Ware License (Revision 42). Подробности в LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- RabbitMQ.Client (>= 7.2.1)
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 |
|---|---|---|
| 1.0.0 | 94 | 4/25/2026 |