LightningQueues 0.5.0-alpha.1
See the version list below for details.
dotnet add package LightningQueues --version 0.5.0-alpha.1
NuGet\Install-Package LightningQueues -Version 0.5.0-alpha.1
<PackageReference Include="LightningQueues" Version="0.5.0-alpha.1" />
paket add LightningQueues --version 0.5.0-alpha.1
#r "nuget: LightningQueues, 0.5.0-alpha.1"
// Install LightningQueues as a Cake Addin #addin nuget:?package=LightningQueues&version=0.5.0-alpha.1&prerelease // Install LightningQueues as a Cake Tool #tool nuget:?package=LightningQueues&version=0.5.0-alpha.1&prerelease
LightningQueues - Fast Persistent Queues for .NET
LightningQueues is a high-performance, lightweight, store-and-forward message queue for .NET applications. Powered by LightningDB (LMDB), it ensures fast and durable persistence for sending and receiving messages, making it an excellent choice for lightweight and cross-platform message queuing needs.
Why LightningQueues?
- Simple API: Easily interact with the message queue through an intuitive API.
- No Administration: Unlike MSMQ or other Server / Brokers, it requires zero administrative setup.
- XCopy Deployable: No complex installation; just copy and run.
- Cross-Platform: Works on Windows, macOS, and Linux.
- Durable Storage: Leverages LMDB for high-performance reliable message storage.
- TLS Encryption: Optionally secure your transport layer. You have full control.
Installation
To use LightningQueues, add it to your .NET project via NuGet:
dotnet add package LightningQueues
Getting Started
Here’s how to use LightningQueues to set up a message queue and send a message:
1. Creating a Queue
using LightningQueues;
// Define queue location and create the queue
var queue = new QueueConfiguration()
.WithDefaults("C:\\path_to_your_queue_folder")
.BuildAndStart("queue-name");
2. Sending Messages
// Send a message to the queue
var message = new Message
{
Data = "hello"u8.ToArray(),
Id = MessageId.GenerateRandom(), //source identifier (for the server instance) + message identifier
Queue = "queue-name",
Destination = new Uri("lq.tcp://localhost:port")
//Note the uri pattern, can be DNS, loopback, etc.
};
queue.Send(message);
3. Receiving Messages
// Start receiving messages asynchronously with IAsyncEnumerable<MessageContext>
var messages = queue.Receive("queue-name", token);
await foreach (var msg in messages)
{
//process the message and respond with one or more of the following
msg.QueueContext.ReceiveLater(TimeSpan.FromSeconds(1));
msg.QueueContext.SuccessfullyReceived(); //nothing more to do, done processing
msg.QueueContext.Enqueue(msg.Message); //ideally a new message enqueued to the queue name on the msg
msg.QueueContext.Send(msg.Message); //send a response or send a message to another uri;
msg.QueueContext.MoveTo("different-queue"); //moves the currently received message to a different queue
msg.QueueContext.CommitChanges(); // Everything previous is gathered in memory and committed in one transaction with LightningDB
}
Running Tests
To ensure everything is running smoothly, clone the repository and run:
dotnet test
Transport Security (TLS Encryption)
LightningQueues supports TLS encryption to secure communication. The library provides hooks to enable custom
certificate validation and encryption settings. For example:
var certificate = LoadYourCertificate();
configuration.SecureTransportWith(new TlsStreamSecurity(async (uri, stream) =>
{
//client side with no validation of server certificate
var sslStream = new SslStream(stream, true, (_, _, _, _) => true, null);
await sslStream.AuthenticateAsClientAsync(uri.Host);
return sslStream;
}),
new TlsStreamSecurity(async (_, stream) =>
{
var sslStream = new SslStream(stream, false);
await sslStream.AuthenticateAsServerAsync(certificate, false,
checkCertificateRevocation: false, enabledSslProtocols: SslProtocols.Tls12);
return sslStream;
}));
You can customize the encryption level based on your requirements.
Licensed under the MIT license.
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. |
-
net9.0
- DotNext.IO (>= 5.18.2)
- LightningDB (>= 0.17.1)
- Microsoft.Extensions.Logging (>= 9.0.2)
- System.IO.Pipelines (>= 9.0.2)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on LightningQueues:
Package | Downloads |
---|---|
FubuMVC.LightningQueues
Package Description |
|
LightningQueues.Storage.LMDB
LightningQueues.Storage.LMDB |
|
FubuTransportation.LightningQueues
LightningQueues integration for FubuTransporation projects |
|
JasperBus
Jasper Service Bus for Messaging Based Architectures |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.5.0-alpha.2 | 54 | 2/27/2025 |
0.5.0-alpha.1 | 47 | 2/27/2025 |
0.4.0 | 2,097 | 1/16/2021 |
0.3.2 | 1,692 | 3/25/2020 |
0.3.1 | 837 | 3/20/2020 |
0.3.0 | 854 | 2/26/2020 |
0.2.12 | 33,514 | 11/23/2016 |
0.2.11 | 6,303 | 11/8/2016 |
0.2.10 | 3,651 | 9/23/2016 |
0.2.9 | 2,760 | 9/2/2016 |
0.2.8 | 1,945 | 8/29/2016 |
0.2.7 | 1,744 | 8/20/2016 |
0.2.6 | 1,943 | 8/20/2016 |
0.2.5 | 2,135 | 8/16/2016 |
0.2.4 | 1,792 | 8/10/2016 |
0.2.3 | 2,503 | 8/8/2016 |
0.2.2 | 1,790 | 8/3/2016 |
0.2.1 | 1,965 | 7/29/2016 |
0.2.0 | 2,441 | 7/27/2016 |
0.2.0-rc2-39 | 1,451 | 7/25/2016 |
0.2.0-rc2-35 | 1,462 | 7/20/2016 |
0.2.0-rc2-33 | 1,505 | 6/28/2016 |
0.1.0.149 | 4,829 | 3/22/2016 |
0.1.0.147 | 2,102 | 12/9/2015 |
0.1.0.134 | 1,743 | 11/4/2015 |
0.1.0.132 | 1,715 | 10/30/2015 |
0.1.0.128 | 1,868 | 10/8/2015 |
0.1.0.81 | 1,888 | 6/26/2014 |
0.1.0.72 | 7,488 | 12/17/2013 |