A study in default contradictions: Don't show me XML, gimme configuration options

time to read 3 min | 489 words

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 id="distributed" endpoint-"msmq://localhost/test_remoteservicebus">
    <subscriptionCache mode="distributed">

    <transport>MassTransit.ServiceBus.MSMQ.MsmqEndpoint, MassTransit.ServiceBus.MSMQ</transport>
    <transport>MassTransit.ServiceBus.NMS.NmsEndpoint, MassTransit.ServiceBus.NMS</transport>

And in NServiceBus case, it is:


<UnicastBusConfig DistributorControlAddress="distributorcontrolbus" DistributorDataAddress="distributordatabus">

<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.