ConvergeERP.Shared.EventBus
1.0.2
dotnet add package ConvergeERP.Shared.EventBus --version 1.0.2
NuGet\Install-Package ConvergeERP.Shared.EventBus -Version 1.0.2
<PackageReference Include="ConvergeERP.Shared.EventBus" Version="1.0.2" />
<PackageVersion Include="ConvergeERP.Shared.EventBus" Version="1.0.2" />
<PackageReference Include="ConvergeERP.Shared.EventBus" />
paket add ConvergeERP.Shared.EventBus --version 1.0.2
#r "nuget: ConvergeERP.Shared.EventBus, 1.0.2"
#:package ConvergeERP.Shared.EventBus@1.0.2
#addin nuget:?package=ConvergeERP.Shared.EventBus&version=1.0.2
#tool nuget:?package=ConvergeERP.Shared.EventBus&version=1.0.2
ConvergeERP.Shared.EventBus
A portable, extensible event bus abstraction for .NET microservices.
IEventBus enables reliable, decoupled event publishing and subscription across distributed systems, supporting multiple transport implementations (e.g., RabbitMQ, Kafka, MassTransit).
Features
- Publish/Subscribe: Decoupled integration event communication
- Transport Agnostic: Use with RabbitMQ, Kafka, MassTransit, or custom brokers
- Integration Event Base: Standardizes event contracts via
IntegrationEvent - Extensible: Implement your own event bus or use provided adapters
Getting Started
1. Add Reference
Add a project reference to ConvergeERP.Shared.EventBus or install the Nuget package into your Application layer if available:
dotnet add package ConvergeERP.Shared.EventBus
Application layer should reference the ConvergeERP.Shared.EventBus project to access the event bus interfaces and base classes.
Once the reference is added, you can start using the event bus in your application services.
2. Define Integration Events
Create integration events by inheriting from IntegrationEvent: This step involves defining the events that represent significant occurrences in your system, such as "OrderCreated" or "UserRegistered". Each event should contain relevant data that subscribers will need to process the event.
You can create multiple events as needed, ensuring that they inherit from IntegrationEvent to maintain consistency and leverage the base functionality provided by the event bus infrastructure.
This should be done in the shared project (ConvergeERP.Shared) that both the Application, Infrastructure layers and other services can access.
public class OrderCreatedEvent : IntegrationEvent
{
public int OrderId { get; }
public DateTime CreatedAt { get; }
public OrderCreatedEvent(int orderId, DateTime createdAt)
{
OrderId = orderId;
CreatedAt = createdAt;
}
}
OR
using ConvergeERP.Shared.EventBus.Events;
public class UserRegisteredEvent : IntegrationEvent
{
public int UserId { get; }
public string Email { get; }
public UserRegisteredEvent(int userId, string email)
{
UserId = userId;
Email = email;
}
}
public class SalaryComponentCreatedIntegratedEvent : IntegrationEvent
{
public Guid SalaryComponentId { get; set; }
public string Name { get; set; } // Add other properties as needed
}
3. Publish Events
To publish events, inject the IEventBus into your application services and call the BroadcastAsync method with your integration event instance. This will send the event to the configured transport for delivery to subscribers.
public class CreateSalaryComponentCommandHandler : IRequestHandler<CreateSalaryComponentCommand, Result<CreateSalaryComponentResponseDto>>
{
private readonly IEventBus _eventBus;
private readonly IUnitOfWork<SalaryComponent> _uow;
public CreateSalaryComponentCommandHandler(IEventBus eventBus, IUnitOfWork<SalaryComponent> uow)
{
_eventBus = eventBus;
_uow = uow;
}
public async Task<Result<CreateSalaryComponentResponseDto>> Handle(CreateSalaryComponentCommand request, CancellationToken cancellationToken)
{
// Logic to create the order...
// Create the SalaryComponentCreatedEvent with relevant data
SalaryComponentCreatedIntegrationEvent @event = new(request.Id, DateTime.UtcNow);
// Publish the SalaryComponentCreatedIntegrationEvent to the event bus for subscribers to consume
await _eventBus.BroadcastAsync(@event, cancellationToken);
await _uow.Repository.AddAsync(new SalaryComponent { Id = request.Id, Name = request.Name });
await _uow.SaveChangesAsync(cancellationToken);
return Result.Success(new CreateSalaryComponentResponseDto { Id = request.Id });
}
}
Note in the above example, we are publishing an SalaryComponentCreatedIntegrationEvent before saving the new SalaryComponent to the database. This allows other services that are subscribed to this event to react accordingly, such as sending notifications or updating read models.
| 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
- Microsoft.Extensions.Options (>= 10.0.2)
NuGet packages (17)
Showing the top 5 NuGet packages that depend on ConvergeERP.Shared.EventBus:
| Package | Downloads |
|---|---|
|
ConvergeERP.Shared.Authorization.Abstractions
Share class library containing services for Authentication and Authorization. |
|
|
ConvergeERP.Shared.EventBus.RabbitMQ
Shared class library using RabbitMQ for high level event bus functionality |
|
|
ConvergeERP.Shared.Employee
Share class library containing integration events. |
|
|
ConvergeERP.Shared.Organization
Share class library containing integration events |
|
|
ConvergeERP.Shared.Identity
Share class library containing integration events. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 1,714 | 3/20/2026 |
| 1.0.1 | 2,819 | 3/4/2026 |
| 1.0.0 | 224 | 2/22/2026 |
| 0.0.1-beta | 2,472 | 4/3/2026 |