开发者

NServiceBus: Object reference exception from NServiceBus.Host

I am getting an exception when I try to start a modified version of the PubSub sample. I am trying to do a few things like making subscription not automatic, and injecting my own ISubscriptionStorage implementation.开发者_C百科 Here is what I did to MyPublisher\EndpointConfig.cs:

using NServiceBus;
using NServiceBus.Grid.MessageHandlers;
using NServiceBus.ObjectBuilder;
using NServiceBus.Sagas.Impl;

namespace MyPublisher
{
    class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization
    {
        public void Init()
        {
            NServiceBus.Configure.With()
                .DefaultBuilder()
                .XmlSerializer()
                .UnicastBus()
                .LoadMessageHandlers(First<GridInterceptingMessageHandler>.Then<SagaMessageHandler>())
                .DoNotAutoSubscribe();

            NServiceBus.Configure.Instance.Configurer.ConfigureComponent<StreamSubscriptionStorage>(ComponentCallModelEnum.Singleton);
        }
    }
}

It used to be this:

using NServiceBus;
using NServiceBus.Grid.MessageHandlers;
using NServiceBus.Sagas.Impl;

namespace MyPublisher
{
    class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, 
        ISpecifyMessageHandlerOrdering
    {
        public void SpecifyOrder(Order order) 
        {
            order.Specify(First<GridInterceptingMessageHandler>.Then<SagaMessageHandler>());
        }
    }
}


You forgot to include the .MsmqTransport() in your custom initialization.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜