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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ArkaSoftware.Extensions.MessageBus.Abstractions" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ArkaSoftware.Extensions.MessageBus.Abstractions" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ArkaSoftware.Extensions.MessageBus.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ArkaSoftware.Extensions.MessageBus.Abstractions --version 2.0.0
                    
#r "nuget: ArkaSoftware.Extensions.MessageBus.Abstractions, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ArkaSoftware.Extensions.MessageBus.Abstractions@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ArkaSoftware.Extensions.MessageBus.Abstractions&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ArkaSoftware.Extensions.MessageBus.Abstractions&version=2.0.0
                    
Install as a Cake Tool

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 Fake implementations 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 248 4/16/2025
1.0.0 201 4/16/2024