Part of what we are currently doing at Hibernating Rhinos is work on some internal applications. In particular, we slowly update our existing applications to do two things:
- Make sure that we are running a maintainable software package.
- Dog food our own stuff in real world scenarios.
In this case, I want to talk about Rhino Service Bus. Corey has been maintaining the project and I haven’t really followed very closely on what was going on. Today we started doing major work on our order processing backend system, so I decided that we might as well ditch the 2.5+ years old version of Rhino Service Bus that we were running and get working with the latest.
I was so lazy about that that I actually didn’t bother to get the sources, and just got the nuget package.
Install-Package Rhino.ServiceBus.Castle
Install-Package Raven.ServiceBus.Host
That got me half way there. No need to worry about adding references, etc, what an awesome idea.
Next, I had to deal with the configuration. Here is how you configure a Rhino Service Bus application (app.config):
<configuration> <configSections> <section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/> </configSections> <rhino.esb> <bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/Orders.Backend" /> <messages> <add name="HibernatingRhinos.Orders.Backend.Messages" endpoint="msmq://localhost/Orders.Backend"/> </messages> </rhino.esb> </configuration>
As you can see, it is fairly simple. Specify the endpoint, and the ownerships of the messages, and you are pretty much done.
The next step is to setup the actual application. In order to do that, we need to define a boot strapper. Think about it like a constructor, but for the entire application. The minimal boot strapper needed is:
public class BootStrapper : CastleBootStrapper { }
Again, it doesn’t really get any simpler.
The next step is somewhat of a pain. A Rhino Service Bus project is usually a class library (dll). So if we want to run it, we need to host it somehwere. RSB comes with Rhino.ServiceBus.Host, but the command line interface sucks. You need to do this to get it running:
Rhino.ServiceBus.Host.exe /Action:Debug /Name:HibernatingRhinos.Orders.Backend /Assembly:.\HibernatingRhinos.Orders.Backend.dll
And honestly, who ever thought about making it so complicated? Give me something to make this simpler, for crying out loud. Moron developer who no consideration of actual system usability.
Oh, yeah, that would be me. Maybe I ought to fix that.
Anyway, that is pretty much everything you need to do to get RSB up & running. Here is a sample test consumer:
public class TestConsumer : ConsumerOf<TestMsg> { public void Consume(TestMsg message) { Console.WriteLine(message.Name); } }
And that is enough for now. See you in the next post…