I am currently doing some work with messaging, and I am using both NServiceBus and Mass Transit, to get a good feel on what best match what I actually need. One of the things that they both have is XML configuration. In Mass Transit case, it looks like this:
<facility id="masstransit"> <bus id="local" endpoint="msmq://localhost/test_servicebus"> <subscriptionCache mode="local" /> <subscriptionService endpoint ="msmq://localhost/mt_pubsub" /> <managementService endpoint ="msmq://localhost/mt_dashboard" /> </bus> <bus id="distributed" endpoint-"msmq://localhost/test_remoteservicebus"> <subscriptionCache mode="distributed"> <servers> <server>192.168.0.1:11211</server> <server>192.168.0.2:11211</server> </servers> </subscription> </bus> <transports> <transport>MassTransit.ServiceBus.MSMQ.MsmqEndpoint, MassTransit.ServiceBus.MSMQ</transport> <transport>MassTransit.ServiceBus.NMS.NmsEndpoint, MassTransit.ServiceBus.NMS</transport> </transports> </facility>
And in NServiceBus case, it is:
<MsmqTransportConfig InputQueue="messagebus" ErrorQueue="error" NumberOfWorkerThreads="2" MaxRetries="5" /> <UnicastBusConfig DistributorControlAddress="distributorcontrolbus" DistributorDataAddress="distributordatabus"> <MessageEndpointMappings> </MessageEndpointMappings> </UnicastBusConfig> <MsmqSubscriptionStorageConfig Queue="subscriptions" />
My first thought when I saw this was "Yuck! How can I get away from this?" Imagine my surprise when I discovered that it is actually not that easy to do.
In NServiceBus case, it is literally not possible without replacing much of the configuration backbone. It is only when I actually stopped my gag reflex and actually read the XML that I realized what is going on here. In both cases, what they are specifying are administrator level settings. I actually want to make it as hard as possible to hard code them.