Wednesday, July 11, 2012

Running 3.x Old School

I've run into a few interesting things that I thought I'd call out after running through an upgrade on my demo project.  Here at work we want to run 3.x as we were running 2.x, but this takes some work.  There are a couple of things you need to take care of.

NHibernate Persistence Requires Different Assemblies

In order to go back to NH persistence you need to pull in the NServiceBus.NHibernate package separately.  You will also need to create your own profile that default to these settings.

        public void ProfileActivated()
        {
            if (!Configure.Instance.Configurer.HasComponent<ISagaPersister>())
                Configure.Instance.NHibernateSagaPersister();

            if (!Configure.Instance.Configurer.HasComponent<IManageMessageFailures>())
                Configure.Instance.MessageForwardingInCaseOfFault();

            if (Configure.Instance.IsTimeoutManagerEnabled())
                Configure.Instance.UseNHibernateTimeoutPersister();

            if (Config is AsA_Publisher && !Configure.Instance.Configurer.HasComponent<ISubscriptionStorage>())
                Configure.Instance.DBSubcriptionStorage();
        }

SLRs and Timeouts Creates Extra Queues

These features require extra queues that you didn't have in 2.x, so these need to be disabled via custom initialization.
        public void Init()
        {
            Configure.With()
                .DefaultBuilder()
                .XmlSerializer()
                .DisableSecondLevelRetries()
                .DisableTimeoutManager();
        }

Timeout Persistence Moved to the Database

There is no more MSMQ timeout persistence, so if you want this back, you'll need to implement it yourself. This should be as simple as going back into the code and copying out the code.