NTDLS.CatMQ.Server
1.0.2
See the version list below for details.
dotnet add package NTDLS.CatMQ.Server --version 1.0.2
NuGet\Install-Package NTDLS.CatMQ.Server -Version 1.0.2
<PackageReference Include="NTDLS.CatMQ.Server" Version="1.0.2" />
paket add NTDLS.CatMQ.Server --version 1.0.2
#r "nuget: NTDLS.CatMQ.Server, 1.0.2"
// Install NTDLS.CatMQ.Server as a Cake Addin #addin nuget:?package=NTDLS.CatMQ.Server&version=1.0.2 // Install NTDLS.CatMQ.Server as a Cake Tool #tool nuget:?package=NTDLS.CatMQ.Server&version=1.0.2
CatMQ
CatMQ is a high-performance and reliable persistent message queue designed for efficient inter-process communication, task queuing, load balancing, and data buffering over TCP/IP.
Packages 📦
- Server Nuget package: https://www.nuget.org/packages/NTDLS.CatMQ.Server
- Client Nuget package: https://www.nuget.org/packages/NTDLS.CatMQ.Client
- Dedicated server install and web UI: https://github.com/NTDLS/CatMQ/releases
Running the server
The server can either be run in-process using the nuget package NTDLS.CatMQ.Server or by downloading and installing the dedicated CatMQ Service, which is a platform independent service that includes a web management interface.
Server
Running the server is quite simple, but configurable. The server does not have to be dedicated either, it can be one of the process that is involved in inner-process-communication.
Alternatively, you can just install the dedicated server which includes a management web UI.
internal class Program
{
static void Main()
{
var server = new CMqServer();
//Listen for queue clients on port 45784
server.StartAsync(45784);
Console.WriteLine("Press [enter] to shutdown.");
Console.ReadLine();
server.Stop();
}
}
Connecting a client to a server
With the client, we can interact with the server. Create/delete/purge queues, subscribe and of course send and received messages. Messages are sent by simply passing a serializable class that inherits from ICMqMessage.
internal class MyMessage(string text) : ICMqMessage
{
public string Text { get; set; } = text;
}
static void Main()
{
var client = new CMqClient(); //Create an instance of the client.
client.Connect("127.0.0.1", 45784); //Connect to the queue server.
client.OnReceived += Client_OnReceived; //Wire up an event to listen for messages.
//Create a queue. These are highly configurable.
client.CreateQueue(new CMqQueueConfiguration("MyFirstQueue")
{
Persistence = PMqPersistence.Ephemeral
});
//Subscribe to the queue we just created.
//For a simplified sample, this will cause this process to receive the messages we send.
client.Subscribe("MyFirstQueue");
//Enqueue a few messages, note that the message is just a class and it must inherit from ICMqMessage.
for (int i = 0; i < 10; i++)
{
client.Enqueue("MyFirstQueue", new MyMessage($"Test message {i++:n0}"));
}
Console.WriteLine("Press [enter] to shutdown.");
Console.ReadLine();
//Cleanup.
client.Disconnect();
}
private static bool Client_OnReceived(CMqClient client, string queueName, ICMqMessage message)
{
//Here we receive the messages for the queue(s) we are subscribed to
// and we can use pattern matching to determine what message was received.
if (message is MyMessage myMessage)
{
Console.WriteLine($"Received: '{myMessage.Text}'");
}
else
{
Console.WriteLine($"Received unknown message type.");
}
return true;
}
Technologies
CatMQ is based heavily on internally built technologies that leverage the works by people much smarter than me. Eternally grateful to all those for making my development a walk in the park.
- Light-weight thread scheduling with sub-pooling: NTDLS.DelegateThreadPooling.
- Nullabily and formatting: NTDLS.Helpers.
- Based heavily on the standalone in-memory message queue: NTDLS.MemoryQueue.
- Round-trip messaging with compression, encryption, checksum and reliability notifications: NTDLS.ReliableMessaging.
- Stream framing for packets reconstruction and fragmentation: NTDLS.StreamFraming.
- Resource protection and concurrency because threads like to bite: NTDLS.Semaphore
- Polymorphic deserialization provided by Newtonsoft.Json because Microsoft refused to add it for "reasons".
- Mega-tight communication enabled by protobuf-net.
- Message persistence provided by rocksdb-sharp.
- Logging, because otherwise we'd be blind: serilog.
- Windows service magic: Topshelf.
Screenshots
Home view
Queue view
Messages view
Message view
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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. |
-
net8.0
- NTDLS.CatMQ.Shared (>= 1.0.0)
- RocksDB (>= 9.7.3.54622)
-
net9.0
- NTDLS.CatMQ.Shared (>= 1.0.0)
- RocksDB (>= 9.7.3.54622)
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.23 | 28 | 1/8/2025 |
1.0.22 | 73 | 1/6/2025 |
1.0.21 | 67 | 1/6/2025 |
1.0.20 | 64 | 1/5/2025 |
1.0.19 | 66 | 1/5/2025 |
1.0.18 | 65 | 1/5/2025 |
1.0.17 | 63 | 1/5/2025 |
1.0.16 | 69 | 1/5/2025 |
1.0.13 | 83 | 1/2/2025 |
1.0.12 | 79 | 1/2/2025 |
1.0.11 | 82 | 1/1/2025 |
1.0.10 | 82 | 1/1/2025 |
1.0.9 | 83 | 12/31/2024 |
1.0.8 | 94 | 12/31/2024 |
1.0.7 | 88 | 12/31/2024 |
Initial release.