Wednesday, January 08, 2014

Neuron ESB and RabbitMQ

I want to make a disclaimer up front - I am currently working for the company that created Neuron ESB, Neudesic. That being said, I genuinely enjoy the product.

Since 2005, most of my time as a developer / consultant has been spent working with Microsoft BizTalk. Microsoft introduced the ESB Guidance (now referred to as the ESB Toolkit) to BizTalk 2006 R2. This introduced capabilities which allowed BizTalk to function as an Enterprise Service Bus. However, I have sometimes found it to be very difficult to get that ESB to do what I want.

I have spend much of the last two years working with an Enterprise Service Bus called Neuron ESB. While no product is perfect, I find that getting it to do what I want generally takes much less work than I was used to, and I'm very happy about that. When I started with Neuron, it supported 4 basic internal transports - Peer, TCP, MSMQ, and Named Pipes. Starting with Neuron ESB 3.0, it now has an additional transport, RabbitMQ. This allows durable, guaranteed, and reliable messaging. The same capabilities are available through MSMQ, but I'm pleased to have an alternative, particularly since RabbitMQ is open source.

The most difficult part of my experience with RabbitMQ was getting it installed properly. Apparently the installer for Neuron ESB can handle that for you automatically (if I had read the manual beforehand I would have known that). In any case, here's what I did to install it.

I first tried to download RabbitMQ and install it. It runs on top of Erlang, so I saw a warning to install Erlang first.

I downloaded Erlang from here. When I first tried to run the Erlang install, it complained about the installed version of the Visual C++ Redistributable. Once I uninstalled the latest versions of it (both 32 and 64 bit versions, although I'm not sure if both were necessary), the Erlang install ran without complaint. After that, the RabbitMQ install also ran through without complaint.

In Neuron, every messaging application you want to create should start with a topic. The topic defines the transport, QoS (Quality of Service), and auditing parameters. So I created a topic and chose RabbitMQ as the transport. To do that, I clicked on Messaging at the bottom left of the window, which navigates to the Messaging area of the application. Then I clicked Topics on the left hand side, and then New on the upper right frame:
To test the topic that uses RabbitMQ - I needed to create a publisher to send messages using the topic, and a subscriber to receive messages. The publisher is an abstract representation of a real world entity (SQL, CRM, C# app) which will be the message source, and the subscriber is an abstract representation of the receiver of the message. Here's what the publisher looks like in Neuron. To create the publisher, I clicked Publishers on the left and then clicked New on the upper right frame. Then I clicked the Edit Subscriptions button to add the ability to publish to the topic.

Creating a subscriber is equally trivial, click on Subscribers, create a new one, and then Edit Subscriptions to allow the subscriber to receive messages with the desired topic. Both publishers and subscribers are Partys in Neuron, and it is possible for a Party to be both a publisher and a subscriber.

After creating the publisher and the subscriber, two queues have now been created in RabbitMQ. To see them, click Deployment on the lower left, followed by RabbitMQ on the left navigation.

Actually testing this scenario highlights one place where Neuron really shines - an easy to use test client is provided which will allow sending messages through the system without needing to connect to any of the resources that will be used in the live environment. We'll need two instances of the test client, one to represent each role (publisher and subscriber). Click the Tools menu all the way at the top of the Neuron ESB Explorer window, then choose 2 Test Clients. In each client, use the drop down menu to choose the Party Id for each test client, and then click Connect. One client should be the publisher party, and the other the subscriber. If you use the Send tab on the publisher client to type and send a message, it will show up on the Receive tab of the subscriber client.

To get more of a sense of how all of how the queuing transport works, I recommend trying other scenarios. For example, try disconnecting the subscriber client temporarily, and then sending a message using the publisher. You will notice that the next time you connect the subscriber, it receives the queued message. Also, try connecting multiple clients as subscribers. When a message is sent, only one client will get the message. That's because all of the subscribers are pulling the message from the same queue, and once it's empty, no one else will see it.

You can download an evaluation version of Neuron ESB here.

No comments: