NServiceBus:来自 NServiceBus.Host 的对象引用异常
当我尝试启动 PubSub 示例的修改版本时,出现异常。我正在尝试做一些事情,例如使订阅不是自动的,以及注入我自己的 ISubscriptionStorage 实现。这是我对 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);
}
}
}
它曾经是这样的:
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>());
}
}
}
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. 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>());
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记在自定义初始化中包含 .MsmqTransport() 。
You forgot to include the .MsmqTransport() in your custom initialization.