Recently, when I had to test some free message queue systems which works with Microsoft .NET I found the list of some interesting systems
. When I found out that Apache ActiveMQ can be also used from .NET, I deiced to test it first. You can see my results below.
A few words about ActiveMQ
is an open source Enterprise Messaging provider which fully implements the Java Message Service. It provides enterprise features like clustering, multiple message stores, and gives the possibility of using any database such as a JMS persistence provider besides VM, cache, and journal persistence. Apart from these features, it’s very important that Apache ActiveMQ supports many Cross Language Clients and Protocols
, especially C# and .NET
. Currently, I’m working on this platform and I’m very glad to have this feature.
The access to ActiveMQ from .NET is provided by Apache .NET Messaging API
(NMS). This API allows to build .NET applications in C#, VB, or any other .NET language, using a single API to connect to multiple providers. Currently, ther are also providers for the following messaging systems: ActiveMQ, MSMQ, EBS and STOMP. Of course I use first one.
I needed a message queue system to solve a specific issue that is presented in the diagram below.
My system with queue
In my system Client 1 needs to send many requests that will be queued. Server application receives and processes a single message quite long time. When processing is complete, the server saves the processed message and receives the next from a queue, and so on. Client 2 application needs to see what is going on with messages in the system. It acts as a monitoring system. Client 2 has 2 functions. Firstly, it gets a processed messages from the server. Secondly, it checks what messages are waiting in the queue. All messages should be persistent.
I wanted to achieve this using ActiveMQ and Apache NMS. Unfortunately, I couldn’t. I failed.
Why not ActiveMQ?
When I was implementing Client 1 and Server, everything was simple and worked properly. All troubles appeared when I wanted to make function that checks messages in queue. On the diagram above this problem is highlighted in red. I found some examples how to do it, but only in Java. I discovered that I have no access to ActiveMQ Broker service by NMS API. I previewed Java ActiveMQ API and I discovered the reason for this situation: Client and Broker implementations are placed in different packages. Of course this is a good design solution. My way of thinking and expectations were wrong. Yet again I realized that Java applications are created for Java and not for .NET developers.
Although Apache ActiveMQ supports .NET, this feature is limited only to basic client operations. Apache ActiveMQ does not give access to manipulate ActiveMQ broker, persistent store or transports.
Share your opinion and experiences with us below or meet us on Twitter: @GOYELLO.
Thanks to Karol Świder for helping me write this blog post.
Tags: .NET, .Net Messaging, ActiveMQ, Broker, Java, Queue