ServiceBusLite.Windows 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ServiceBusLite.Windows --version 1.0.1
                    
NuGet\Install-Package ServiceBusLite.Windows -Version 1.0.1
                    
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="ServiceBusLite.Windows" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ServiceBusLite.Windows" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ServiceBusLite.Windows" />
                    
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 ServiceBusLite.Windows --version 1.0.1
                    
#r "nuget: ServiceBusLite.Windows, 1.0.1"
                    
#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 ServiceBusLite.Windows@1.0.1
                    
#: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=ServiceBusLite.Windows&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ServiceBusLite.Windows&version=1.0.1
                    
Install as a Cake Tool

ServiceBusLite.Windows

ServiceBusLite.Windows is a lightweight, local message bus for isolated Windows networks. It is designed to fully decouple publishers and subscribers, making inter-process communications easy to manage. With very little configuration, you can fire off an event and forget all about it - it will get where it needs to, usually within milliseconds. Persistence is built in, so you can pick up where you left off in case of system downtime.

Why choose ServiceBusLite.Windows

Choose ServiceBusLite.Windows if you need an off-the-shelf service bus which runs on isolated windows networks.

Features:

  • ✅ Completely decoupled pub/sub architecture - no direct connections!
  • ✅ Built-in persistence — never lose messages, even across application restarts
  • ✅ Fire-and-forget philosophy with fast, reliable delivery up to 200 events / second
  • ✅ Low configuration — ready to use with minimal setup

Installation

Install via NuGet:

dotnet add package ServiceBusLite.Windows

Or via the NuGet Package Manager Console:

Install-Package ServiceBusLite.Windows

Quickstart

  1. Create an event with a topic attribute, and with MessagePack attributes: [ℹ ⬇️]
[MessagePackObject]
[Topic("MyFirstTopic")]
public class TestEvent
{
    [Key(0)]
    public required string Id { get; set; }
    [Key(1)]
    public required string Message { get; set; }
}
  1. Create a publisher:
public class MessagePublisher : IDisposable
{
    private readonly IEventPublisher<TestEvent> _publisher;

    public MessagePublisher()
    {
        _publisher = PublisherFactory.Create<TestEvent>("test-publisher", new PublisherOptions { DeliveryMode = DeliveryMode.Message});
    }

    public Task PublishEvent(TestEvent _event, CancellationToken cancellationToken = default) =>
        _publisher.PublishEvent(_event, cancellationToken);

    public void Dispose()
    {
        _publisher?.Dispose();
    }
}
  1. Create a subscriber:
public class MessageSubscriber: IDisposable
{
    private readonly IEventSubscriber<TestEvent> _subscriber;

    public MessageSubscriber()
    {
        _subscriber = SubscriberFactory.Create<TestEvent>("test-subscriber", new SubscriberOptions { DeliveryMode = DeliveryMode.Message });
        _subscriber.OnEventReceived += HandleEvent;
    }

    public Task Start() => _subscriber.Start();

    private void HandleEvent(TestEvent _event)
        => Console.WriteLine($"Received a message: {_event.Message}. Thank you ServiceBusLite.Windows!");

    public void Dispose()
    {
        _subscriber.OnEventReceived -= HandleEvent;
        _subscriber.Dispose();
    }
}
  1. Run it:
var publisher = new MessagePublisher();
var subscriber = new MessageSubscriber();
await subscriber.Start();

await publisher.PublishEvent(new TestEvent { Id = 1, Message = "HeLlo, WOrld!" });

// Hang so that the subscriber thread can log your message.
Console.ReadKey();

Console.WriteLine("Shutting down...");

Acknowledgment
Serialisation using MessagePack for C# is part of what makes ServiceBusLite.Windows so quick. Huge thanks to Yoshifumi Kawai for his work.

Documentation

I will get round to writing some proper documentation at some point. For now, here is what you need to know:

  1. The publisher and subscriber(s) do not need to be in the same service, as long as they are hosted on the same PC. Network options for inter-PC comms will be coming soon.
  2. ⚠️⚠️ You should only have 1 publisher per topic accross your system. ⚠️⚠️ ServiceBusLite.Windows will let you create as many as you want, but you will have a bad time if you do.
  3. ⚠️⚠️ You can only have 1 event class per topic ⚠️⚠️ Multi-event topics will be coming soon.
  4. There are two operational delivery modes; DeliverMode.Message delivers events to a single subscriber on a first-come, first-served basis. DeliverMode.Event delivers to all subscribers. ⚠️ DeliverMode must match between publisher and subscriber.
  5. Other configuration options you should consider:
  • RetentionMode - Events can be automatically expired after x seconds (RetentionMode.Auto or RetentionMode.AutoFor(TimeSpan timeSpan) or you can choose to manually expire events. with RetentionMode.Manual. ⚠️ Manual control is not advised, but it is included for completeness.
  • StartupMode - StartupMode.LookAhead will only respond to new events that arrive after startup. StartupMode.CatchUp will run through all events that have not expired.

Terms of use

This project is licensed under the BSD 3-Clause License. You’re free to use and distribute this package for personal or commercial projects, under the conditions of the licence. I only ask for acknowledgement, so please give me a shout-out. E.g.

Built using ServiceBusLite.Windows, Copyright (c) 2025, RCru

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
1.0.2 509 7/22/2025
1.0.1 122 7/14/2025
1.0.0 117 7/14/2025