ArkaSoftware.Extensions.MessageBus.Abstractions
2.0.0
dotnet add package ArkaSoftware.Extensions.MessageBus.Abstractions --version 2.0.0
NuGet\Install-Package ArkaSoftware.Extensions.MessageBus.Abstractions -Version 2.0.0
<PackageReference Include="ArkaSoftware.Extensions.MessageBus.Abstractions" Version="2.0.0" />
<PackageVersion Include="ArkaSoftware.Extensions.MessageBus.Abstractions" Version="2.0.0" />
<PackageReference Include="ArkaSoftware.Extensions.MessageBus.Abstractions" />
paket add ArkaSoftware.Extensions.MessageBus.Abstractions --version 2.0.0
#r "nuget: ArkaSoftware.Extensions.MessageBus.Abstractions, 2.0.0"
#:package ArkaSoftware.Extensions.MessageBus.Abstractions@2.0.0
#addin nuget:?package=ArkaSoftware.Extensions.MessageBus.Abstractions&version=2.0.0
#tool nuget:?package=ArkaSoftware.Extensions.MessageBus.Abstractions&version=2.0.0
ArkaSoftware.Extensions.MessageBus.Abstractions
ArkaSoftware.Extensions.MessageBus.Abstractions provides clean, extensible interfaces and models for building distributed applications using the Message Bus pattern in .NET. It includes contracts for sending and receiving commands and events, handling message inbox, and working with structured message envelopes.
โจ Features
- ๐จ Send and receive events and commands
- ๐ฆ Standardized message structure via
Parcel - ๐ Idempotent message processing with
IMessageInboxItemRepository - ๐ Clean separation of concerns with abstractions
- ๐งช Built-in
Fakeimplementations for local testing and development
๐งฉ Core Interfaces
ISendMessageBus
Defines methods for publishing events and sending commands.
public interface ISendMessageBus
{
void Publish<TInput>(TInput input);
void SendCommandTo<TCommandData>(string destinationService, string commandName, TCommandData commandData);
void SendCommandTo<TCommandData>(string destinationService, string commandName, string correlationId, TCommandData commandData);
void Send(Parcel parcel);
}
IReceiveMessageBus
Defines how the service subscribes to events and receives commands.
public interface IReceiveMessageBus
{
void Subscribe(string serviceId, string eventName);
void Receive(string commandName);
}
IMessageConsumer
Defines how incoming commands and events are handled.
public interface IMessageConsumer
{
Task<bool> ConsumeEvent(string sender, Parcel parcel);
Task<bool> ConsumeCommand(string sender, Parcel parcel);
}
IMessageInboxItemRepository
Supports deduplication and idempotency by checking and storing received messages.
public interface IMessageInboxItemRepository
{
bool AllowReceive(string messageId, string fromService);
void Receive(string messageId, string fromService, string payload);
}
Parcel
Represents a structured message envelope, including headers and payload:
public class Parcel
{
public string MessageId { get; set; }
public string CorrelationId { get; set; }
public string MessageName { get; set; }
public Dictionary<string, object> Headers { get; set; }
public string MessageBody { get; set; }
public string Route { get; set; }
}
๐งช Fakes for Testing
FakeSendMessageBus
A fake implementation of ISendMessageBus that logs operations for test environments.
public class FakeSendMessageBus : ISendMessageBus
{
public void Publish<TInput>(TInput input) { ... }
public void SendCommandTo(...) { ... }
}
FakeReceiveMessageBus
Logs subscription and receive operations for testing.
public class FakeReceiveMessageBus : IReceiveMessageBus
{
public void Receive(string commandName) { ... }
public void Subscribe(string serviceId, string eventName) { ... }
}
FakeMessageConsumer
Simulates consuming commands and events, printing message info to the console.
public class FakeMessageConsumer : IMessageConsumer
{
public Task<bool> ConsumeEvent(...) { ... }
public Task<bool> ConsumeCommand(...) { ... }
}
โ Use Cases
Event-Driven Microservices
Asynchronous Messaging
Decoupling between services
Outbox & Inbox patterns
Integration with RabbitMQ, Kafka, Azure Service Bus, etc.
๐ข Maintained by
ArkaSoftware
๐ง Email Us
๐ Web Site Visit
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.