Ayende @ Rahien

Unnatural acts on source code

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

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.

Comments

RafalG
12/12/2008 08:16 PM by
RafalG

Thanks for mentioning the Mass Transit project, I was unaware of its existence. What do you mean by hardcoding config values? I see Mass Transit supports some IOC containers, so the configuration will probably be handled by the container. Or, do you mean runtime configuration - modifying the config without restarting the application?

Rafal

Volkov
12/15/2008 02:11 AM by
Volkov

I'd much rather use ActiveMQ's NMS

Comments have been closed on this topic.