Fermat.EventBus.Base
0.0.1
dotnet add package Fermat.EventBus.Base --version 0.0.1
NuGet\Install-Package Fermat.EventBus.Base -Version 0.0.1
<PackageReference Include="Fermat.EventBus.Base" Version="0.0.1" />
<PackageVersion Include="Fermat.EventBus.Base" Version="0.0.1" />
<PackageReference Include="Fermat.EventBus.Base" />
paket add Fermat.EventBus.Base --version 0.0.1
#r "nuget: Fermat.EventBus.Base, 0.0.1"
#:package Fermat.EventBus.Base@0.0.1
#addin nuget:?package=Fermat.EventBus.Base&version=0.0.1
#tool nuget:?package=Fermat.EventBus.Base&version=0.0.1
Fermat.EventBus.Base
Fermat.EventBus.Base is a NuGet package that provides the core infrastructure for implementing event-driven architecture in .NET applications. It offers a flexible and extensible foundation for managing integration events.
Features
- 🚀 Easy integration event management
- 🔄 Asynchronous event processing
- 📦 Flexible configuration options
- 🔍 Event subscription management
- 🛡️ Error handling and monitoring
- 🏗️ Extensible architecture
Installation
dotnet add package Fermat.EventBus.Base
Usage
1. Define Your Event
public class UserCreatedEvent : IntegrationEvent
{
public string UserId { get; set; }
public string UserName { get; set; }
}
2. Create an Event Handler
public class UserCreatedEventHandler : IIntegrationEventHandler<UserCreatedEvent>
{
private readonly ILogger<UserCreatedEventHandler> _logger;
public UserCreatedEventHandler(ILogger<UserCreatedEventHandler> logger)
{
_logger = logger;
}
public async Task Handle(UserCreatedEvent @event)
{
_logger.LogInformation("User created: {UserId}, {UserName}",
@event.UserId, @event.UserName);
await Task.CompletedTask;
}
}
3. Configure EventBus
// Using the builder pattern
var config = EventBusConfig.CreateBuilder()
.WithConnectionRetryCount(5)
.WithDefaultTopicName("DefaultTopicName")
.WithSubscriberClientAppName(AppDomain.CurrentDomain.FriendlyName)
.WithEventNamePrefix(string.Empty)
.WithEventNameSuffix(string.Empty)
.Build();
// Register in DI container
services.AddSingleton<IEventBus>(sp =>
new YourEventBusImplementation(config, sp));
4. Publish and Subscribe to Events
// Publish an event
await _eventBus.PublishAsync(new UserCreatedEvent
{
UserId = "123",
UserName = "John Doe"
});
// Subscribe to an event
await _eventBus.SubscribeAsync<UserCreatedEvent, UserCreatedEventHandler>();
Configuration Options
Option | Description | Default |
---|---|---|
ConnectionRetryCount | Number of connection retry attempts | 5 |
DefaultTopicName | Default topic name for event publishing | "DefaultTopicName" |
SubscriberClientAppName | Subscriber client application name | Application name |
EventNamePrefix | Prefix for event names | "" |
EventNameSuffix | Suffix for event names | "IntegrationEvent" |
Error Handling
The package supports the following error types:
SubscriptionError
: Errors related to subscription managementPublishingError
: Errors related to event publishingHandlerExecutionError
: Errors related to event handler executionConnectionError
: Errors related to event bus connectionConfigurationError
: Errors related to event bus configuration
Integration with Other Packages
Fermat.EventBus.Base can be extended with additional packages:
Fermat.EventBus.RabbitMq
: RabbitMQ implementationFermat.EventBus.InMemory
: In-memory implementation for testing
Example with RabbitMQ:
services.AddEventBusRabbitMq(options =>
{
options.ConnectionRetryCount = 5;
options.DefaultTopicName = "DefaultTopicName";
options.SubscriberClientAppName = AppDomain.CurrentDomain.FriendlyName;
options.EventNamePrefix = string.Empty;
options.EventNameSuffix = string.Empty;
// RabbitMQ connection settings
options.Host = "localhost";
options.Port = 5672;
options.UserName = "admin";
options.Password = "password";
// Register event handlers
options.AddEventHandler<UserCreatedEventHandler>();
// Add subscriptions
options.AddSubscription<UserCreatedEvent, UserCreatedEventHandler>();
});
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.7)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Fermat.EventBus.Base:
Package | Downloads |
---|---|
Fermat.EventBus.InMemory
Fermat EventBus InMemory is an in-memory implementation of the Fermat EventBus, designed for high-performance event handling in .NET applications. |
|
Fermat.EventBus.RabbitMq
Fermat EventBus RabbitMQ implementation for .NET applications. |
|
Fermat.EventBus.AzureServiceBus
A library that provides an implementation of the Fermat EventBus using Azure Service Bus for event-driven communication in .NET applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.0.1 | 84 | 7/29/2025 |