Skip to content
RudyMQ - A rudimentary Message Queue
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A Rudimentary Message Queue for Windows

By Aashish Koirala

RudyMQ is a lightweight message queue for Windows built using .NET and WCF that you may want to consider if you don't need the enterprise grade features of MSMQ and don't want to deal with all of its tantrums and oh-so-friendly error messages. It supports persistent messages and also comes with its own WCF binding.

Getting Started

  • To install or host the server:
  • Download, install and configure the server installation (see Server Installation), or:
  • Download the NuGet package RudyMQ.Service and add to your hosting application (see Self Hosting).
  • To talk to an existing instance:
  • Download the NuGet package RudyMQ.Client and add to your application
  • Access the queue API directly (see Queue API) or use the WCF binding provided (see WCF Binding)

Server Installation

  • Make sure .NET 4.5 is installed on your system.
  • Download the server installation here.
  • Extract the files.
  • If you want to, make changes to the AK.RudyMQ.Service.Host.exe.config file as needed. Instructions can be found inside the file itself.
  • Run Install.cmd.
  • A new service for RudyMQ should be registered which you can now start like any other service.

Self Hosting

  • Add the NuGet package RudyMQ.Service to your hosting application (which may be a web application, a Windows or console application, an Azure worker role - whatever).

  • Use the QueueHost class to instantiate and listen.

  • Example:

      using (var queueHost = new QueueHost(hostName, port, baseAddress,
      	catalogLocation, persistLocation, transitLocation, transitCleanupInterval, transitMaximumAge)
      	// ...

Queue API

  • Add the NuGet package RudyMQ.Client to your application.

  • You can send or receive typed messages. Message types can be any simple and serializable data structure. It needs to be marked as Serializable.

  • Sending a message:

      var conn = MessageQueue.Connect(hostName, port, baseAddress);
      var queue = conn.Get("MyQueue");
      var message = new MyMessage { ... };
  • Receiving a message:

      // Here, receiveOperation is IDisposable. You can call Stop on it, or just Dispose it,
      // use it inside a using block, whatever, when you want to stop receiving.
      var receiveOperation = queue.StartReceiving<MyMessage>(100, /* poll every 100 ms */
      	message =>
      		// Handle received message here.
          }, exception =>
      		// Handle exception here.
  • Other operations:

      conn.Create("MyQueue", true, false); // Create a new queue.
      conn.Remove("ExistingQueue"); // Remove an existing queue.
      queue.Purge<MyMessage>(); // Remove all messages of type MyMessage from the queue.
      queue.PurgeAll(); // Remove all messages from the queue.

WCF Binding

  • Just as with MSMQ, you can use RudyMQ as a transport mechanism for one-way WCF operations.

  • The binding is part of the RudyMQ.Client package.

  • The endpoint address is of the form net.rudymq://hostname: port/baseAddress/queueName

  • Example server side WCF configuration:

      			<add name="rudyMqBinding" type="AK.RudyMQ.Client.ServiceModel.RudyMqBindingSection, AK.RudyMQ.Client"/>
    			<service name="...">
      			<endpoint address="net.rudymq://..." binding="rudyMqBinding" contract="..." />
  • Example client side WCF configuration:

      			<add name="rudyMqBinding" type="AK.RudyMQ.Client.ServiceModel.RudyMqBindingSection, AK.RudyMQ.Client"/>
      		<endpoint address="net.rudymq://..." binding="rudyMqBinding" contract="..." />
  • Example server side when done programmatically:

      using (var serviceHost = new ServiceHost(...))
          serviceHost.AddServiceEndpoint(..., new RudyMqBinding(), "net.rudymq://...");
  • Example client side when done programmatically:

      var proxy = new _ServiceProxyClass_(new RudyMqBinding(), "net.rudymq://...");
You can’t perform that action at this time.