SHAKA.MessageBus.IntegrationEventLog
1.0.3
dotnet add package SHAKA.MessageBus.IntegrationEventLog --version 1.0.3
NuGet\Install-Package SHAKA.MessageBus.IntegrationEventLog -Version 1.0.3
<PackageReference Include="SHAKA.MessageBus.IntegrationEventLog" Version="1.0.3" />
<PackageVersion Include="SHAKA.MessageBus.IntegrationEventLog" Version="1.0.3" />
<PackageReference Include="SHAKA.MessageBus.IntegrationEventLog" />
paket add SHAKA.MessageBus.IntegrationEventLog --version 1.0.3
#r "nuget: SHAKA.MessageBus.IntegrationEventLog, 1.0.3"
#:package SHAKA.MessageBus.IntegrationEventLog@1.0.3
#addin nuget:?package=SHAKA.MessageBus.IntegrationEventLog&version=1.0.3
#tool nuget:?package=SHAKA.MessageBus.IntegrationEventLog&version=1.0.3
Event-Driven Repository Abstraction
This project defines an abstraction for working with databases in an Event-Driven System.
Overview
IEntity Abstraction
The core of this project starts with defining a generic IEntity
abstraction. This interface mandates that all entities must implement an Id
property. The Id
type is specified using a generic parameter, allowing flexibility in choosing different types of identifiers, such as int
, Guid
, string
, etc., as long as the type implements IEquatable<T>
.
IIntegrationEventLog
The IIntegrationEventLog
interface defines the structure of an integration event log. Since different infrastructures may require distinct implementations, this is designed as an interface rather than a class. For example, in an EF Core implementation, attributes may need to be added to its properties to align with entity framework conventions.
Failed Message Handling
We introduce two key abstractions for handling failed messages:
IFailedMessageChain
: Manages sequentially failed messages associated with a single entity. It includes properties such as:EntityId
: Specifies the ID of the entity to which the failed messages belong.ShouldRepublish
: Determines whether the failed message republisher should retry processing the chained messages.
IFailedMessage
: Represents an individual failed message and contains:- The serialized failed message.
- Error message and stack trace.
ShouldSkip
: Indicates whether the message should be republished.
Note: The
EventStateEnum.PublishedFailed
state is distinct from failed messages.PublishedFailed
indicates that a message did not reach the broker, whereas failed messages occur when a handler throws an exception while processing the message.
Services
IIntegrationEventLogService
This service provides an abstraction for handling integration event logs, allowing us to implement the Outbox Pattern to maintain consistency across microservices. The service includes:
- Retrieving batched pending events for the publisher.
- Creating failed message chains via
AddInFailedMessageChain
. - Updating event statuses through:
MarkEventAsPublished()
MarkEventAsInProgress()
MarkEventAsFailed()
IIntegrationEventService
This service is responsible for managing actual integration events and provides:
- Add, Update, and Remove methods to perform CRUD operations on entities while maintaining respective integration event logs.
Publisher Background Service
The project includes a Publisher Background Service that automates event publishing. It:
- Publishes pending events.
- Republishes failed events.
Configuration
The service can be configured via PublisherOptions
, where you can specify:
Delay
EventsBatchSize
FailedMessageChainBatchSize
EventTypesAssemblyName
To configure the Publisher Background Service, use the ConfigurePublisher()
extension method.
This abstraction ensures robust event-driven database operations while preventing inconsistencies between microservices.
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.Hosting.Abstractions (>= 8.0.1)
- SHAKA.MessageBus (>= 1.1.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SHAKA.MessageBus.IntegrationEventLog:
Package | Downloads |
---|---|
SHAKA.MessageBus.RabbitMQ
A robust implementation of the MessageBus abstraction for .NET applications, built on top of RabbitMQ. This package enables seamless, scalable, and reliable communication between different components of your system using the powerful messaging capabilities of RabbitMQ. It offers a simple and intuitive API to send and receive messages in an event-driven architecture. Key Features: Built on RabbitMQ – Leverage the reliability and performance of RabbitMQ for message delivery. MessageBus Abstraction – Easily integrate RabbitMQ into any MessageBus-based architecture. Flexible Messaging – Supports both synchronous and asynchronous messaging. Scalability – Efficiently handle high message throughput in distributed systems. Simple API – Easy-to-use interface to publish and subscribe to messages without worrying about RabbitMQ internals. Usage: Ideal for microservices, event-driven architectures, or any .NET application that requires reliable message-based communication. Easily integrates into existing systems that require RabbitMQ for message delivery. Prerequisites: RabbitMQ server running and accessible from your application. |
|
SHAKA.MessageBus.IntegrationEventLog.EF
A robust EF Core-based implementation of `SHAKA.MessageBus.IntegrationEventLog`, enabling seamless event persistence, failure tracking, and reliable publishing in event-driven systems. |
GitHub repositories
This package is not used by any popular GitHub repositories.