Cosmos.EventDriven.Abstractions
2.0.0
dotnet add package Cosmos.EventDriven.Abstractions --version 2.0.0
NuGet\Install-Package Cosmos.EventDriven.Abstractions -Version 2.0.0
<PackageReference Include="Cosmos.EventDriven.Abstractions" Version="2.0.0" />
<PackageVersion Include="Cosmos.EventDriven.Abstractions" Version="2.0.0" />
<PackageReference Include="Cosmos.EventDriven.Abstractions" />
paket add Cosmos.EventDriven.Abstractions --version 2.0.0
#r "nuget: Cosmos.EventDriven.Abstractions, 2.0.0"
#:package Cosmos.EventDriven.Abstractions@2.0.0
#addin nuget:?package=Cosmos.EventDriven.Abstractions&version=2.0.0
#tool nuget:?package=Cosmos.EventDriven.Abstractions&version=2.0.0
Cosmos.EventDriven.Abstractions
Abstracciones fundamentales para implementar Event Driven Architecture (EDA) en .NET 10.
Descripción
Este paquete proporciona las interfaces base necesarias para construir aplicaciones basadas en arquitecturas orientadas a eventos. Define contratos claros para la publicación de eventos públicos (inter-servicio) y eventos privados (intra-servicio).
Características
- IPublicEvent: Marcador para eventos publicados a servicios externos vía broker (RabbitMQ, Azure Service Bus, etc.)
- IPrivateEvent: Marcador para eventos publicados dentro del mismo bounded context
- IPublicEventSender: Interfaz para publicar
IPublicEventde forma asíncrona - IPrivateEventSender: Interfaz para publicar
IPrivateEventde forma asíncrona - PublishOptions: Opciones del sobre (
GroupIdpara orden FIFO yHeadersarbitrarios) para publicar sin explotar la matriz de sobrecargas - Sin dependencias de implementación concreta
Instalación
dotnet add package Cosmos.EventDriven.Abstractions
Uso
Definir un Evento Público (inter-servicio)
using Cosmos.EventDriven.Abstractions;
public record UserRegistered(
string UserId,
string Email,
DateTime RegisteredAt
) : IPublicEvent;
Definir un Evento Privado (intra-servicio)
using Cosmos.EventDriven.Abstractions;
public record UserProfileUpdated(
string UserId,
string NewEmail
) : IPrivateEvent;
Publicar un Evento Público
public class UserService
{
private readonly IPublicEventSender _publicEventSender;
public UserService(IPublicEventSender publicEventSender)
{
_publicEventSender = publicEventSender;
}
public async Task RegisterUser(string userId, string email)
{
// Lógica de negocio...
var @event = new UserRegistered(userId, email, DateTime.UtcNow);
await _publicEventSender.PublishAsync(@event);
}
}
Publicar Eventos Privados
public class UserService
{
private readonly IPrivateEventSender _privateEventSender;
public UserService(IPrivateEventSender privateEventSender)
{
_privateEventSender = privateEventSender;
}
public async Task UpdateProfile(string userId, string newEmail)
{
// Lógica de negocio...
var @event = new UserProfileUpdated(userId, newEmail);
await _privateEventSender.PublishAsync(@event);
}
}
Publicar con opciones del sobre (headers / clave de enrutamiento)
Cuando el destinatario debe enrutarse por una clave de enrutamiento (por ejemplo, un correlation filter de Azure Service Bus que solo evalúa las application properties del mensaje, no su body), estampa esa clave como un header arbitrario del sobre vía PublishOptions.Headers:
using Cosmos.EventDriven.Abstractions;
var options = new PublishOptions
{
Headers = new Dictionary<string, string> { ["applicationBundleId"] = applicationBundleId },
};
await _publicEventSender.PublishAsync(options, @event);
GroupId (orden FIFO / SessionId) y Headers (clave de enrutamiento) son ortogonales: pueden usarse por separado o juntos en el mismo PublishOptions, sin conflacionarse.
var options = new PublishOptions { GroupId = "cuenta-123", Headers = headers };
En Azure Service Bus, los
Headersse materializan como application properties del mensaje (matcheables por unCorrelationFilterde igualdad); en RabbitMQ, como headers.
Distinción IPublicEvent vs IPrivateEvent
| IPublicEvent | IPrivateEvent | |
|---|---|---|
| Alcance | Inter-servicio | Intra-servicio (mismo bounded context) |
| Broker | RabbitMQ, Azure Service Bus | Bus local de Wolverine |
| Uso típico | Notificar a otros microservicios | Desacoplar lógica dentro del mismo servicio |
Implementaciones Concretas
Para implementaciones listas para usar con Wolverine, consulta:
- Cosmos.EventDriven.CritterStack — implementaciones base con Wolverine
- Cosmos.EventDriven.CritterStack.RabbitMQ — extensiones para RabbitMQ
- Cosmos.EventDriven.CritterStack.AzureServiceBus — extensiones para Azure Service Bus
Requisitos
- .NET 10.0 o superior
Licencia
Copyright © Cosmos. Todos los derechos reservados.
| 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. |
-
net10.0
- No dependencies.
NuGet packages (20)
Showing the top 5 NuGet packages that depend on Cosmos.EventDriven.Abstractions:
| Package | Downloads |
|---|---|
|
Cosmos.EventSourcing.Abstractions
Abstracciones de EventSourcing para Cosmos |
|
|
Cosmos.EventDriven.CritterStack
Implementaciones de Wolverine para IPublicEventSender e IPrivateEventSender en Cosmos EDA |
|
|
Cosmos.EventDriven.CritterStack.RabbitMQ
Integración de RabbitMQ con Wolverine para Cosmos EDA |
|
|
Cosmos.EventDriven.CritterStack.AzureServiceBus
Integración de Azure Service Bus con Wolverine para Cosmos EDA |
|
|
ObligacionesPorPagar.Entradas.Contratos
Contratos de reconocimiento expuestos a terceros. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 39 | 7/15/2026 |
| 1.3.0 | 412 | 7/9/2026 |
| 1.2.6 | 205 | 7/3/2026 |
| 1.2.5 | 378 | 7/1/2026 |
| 1.2.4 | 553 | 7/1/2026 |
| 1.2.3 | 699 | 6/18/2026 |
| 1.2.2 | 906 | 6/12/2026 |
| 1.2.1 | 329 | 6/12/2026 |
| 1.2.0 | 192 | 6/11/2026 |
| 1.1.0 | 686 | 6/3/2026 |
| 1.0.0 | 814 | 6/2/2026 |
| 0.0.8 | 3,105 | 3/17/2026 |
| 0.0.7 | 2,280 | 3/12/2026 |
| 0.0.6 | 150 | 3/12/2026 |
| 0.0.5 | 149 | 3/12/2026 |
| 0.0.5-RC.2 | 86 | 3/11/2026 |
| 0.0.5-RC.1 | 99 | 3/10/2026 |
| 0.0.4 | 2,803 | 12/3/2025 |
| 0.0.3 | 250 | 11/25/2025 |
| 0.0.1 | 448 | 9/19/2025 |