NTDLS.CatMQ.Server 1.0.2

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package NTDLS.CatMQ.Server --version 1.0.2                
NuGet\Install-Package NTDLS.CatMQ.Server -Version 1.0.2                
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="NTDLS.CatMQ.Server" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NTDLS.CatMQ.Server --version 1.0.2                
#r "nuget: NTDLS.CatMQ.Server, 1.0.2"                
#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.
// 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 📦

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.

Screenshots

Home view

image

Queue view

image

Messages view

image

Message view

image

License

MIT

Product 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. 
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.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.