Update: this post was written more than a year ago and since then the NetMQ has become the default ZeroMQ choice for .Net developers. Also the project has a growing community with more than 4,000 downloads on nuget and it is a production ready library.
ZeroMQ is a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ZeroMQ system can run without a dedicated message broker. The library is designed to have a familiar socket-style API.
If you are not familiar with ZeroMQ, (also spelled ØMQ, 0MQ or ZMQ) you should be, becuse besides being a very fast messaging library it’s also changes the way you think about programming. If you really want to learn about ZeroMQ, make sure to read Pieter Hintjens book “Code Connected”. The ebook version is free and you can get it here or you can also read it on the ZeroMQ website.
This book will change the way you think about distributed enterprise systems and about programming all together. It did for me and I read it
3 6 times already, front to back and I will probably read it again.
How it all started
So the NetMQ project started as a weekend project (I have plenty of those, but most of them stay on my computer).
The original reason was that the library was missing some features that I really needed in order to push ZeroMQ at my company. But not being familiar with the library and C++ not being my native programming language I decided to port it to C#.
Lucky for me, somebody already did part of the job by porting ZeroMQ to Java. With java being more close to C# then C++, I took the java project as my base project. And 30 hours later and after a lot of coffee and no sleep ZeroMQ was ported to C#. It took me around 4 more month to do the extra 20% and make it ready for use.
So if you want to use ZeroMQ or already are using ZeroMQ and you are developing with .Net, I would suggest that your try out NetMQ. You might be asking yourself, “why should I use NetMQ and not ZeroMQ with the C# binding?” I have multiple answers for this question:
- Running unmanaged code inside a managed application can do some nasty stuff like memory leak and weird no access errors.
- It is easier to debug with native c# code and you can download the code and just debug your system.
- You can contribute. If you are using .Net, then C# is probably better than your C++, and NetMQ gives you the opportunity to give something back to the community and get your name on the contributors list.
- Update: As of 2014 C# binding (CLRZMQ) is no longer maintained and NetMQ is the default choice for ZeroMQ and .Net.
- Update: As of 2014 NetMQ is a stable project with a growing community and is in production use by multiple companies.