ServiceBusLite.Windows
1.0.1
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
<PackageReference Include="ServiceBusLite.Windows" Version="1.0.1" />
<PackageVersion Include="ServiceBusLite.Windows" Version="1.0.1" />
<PackageReference Include="ServiceBusLite.Windows" />
paket add ServiceBusLite.Windows --version 1.0.1
#r "nuget: ServiceBusLite.Windows, 1.0.1"
#:package ServiceBusLite.Windows@1.0.1
#addin nuget:?package=ServiceBusLite.Windows&version=1.0.1
#tool nuget:?package=ServiceBusLite.Windows&version=1.0.1
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
- 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; }
}
- 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();
}
}
- 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();
}
}
- 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:
- 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.
- ⚠️⚠️ 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.
- ⚠️⚠️ You can only have 1 event class per topic ⚠️⚠️ Multi-event topics will be coming soon.
- 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. - Other configuration options you should consider:
RetentionMode
- Events can be automatically expired after x seconds (RetentionMode.Auto
orRetentionMode.AutoFor(TimeSpan timeSpan)
or you can choose to manually expire events. withRetentionMode.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 | 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
- Dapper (>= 2.1.66)
- log4net (>= 3.1.0)
- MessagePack (>= 3.1.4)
- Microsoft.Data.Sqlite (>= 9.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.