c# - nservicebus启动错误

标签 c# nservicebus esb cqrs

我正在尝试启动并运行我的 NServiceBus 设置。

我基本上是在尝试复制一些 AsyncPages 示例项目。

在我的 CommandServer 项目中,我有以下配置:

 <MsmqTransportConfig
    InputQueue="SonatribeInputQueue"
    ErrorQueue="error"
    NumberOfWorkerThreads="1"
    MaxRetries="5"
/>

我有以下消息端点:

public class MessageEndpoint : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
    {
        /// <summary>
        /// Perform initialization logic.
        /// </summary>
        public void Init()
        {
            Console.WriteLine("Configuring persistence...");
            var container = new WindsorContainer();
            container.Install(FromAssembly.InDirectory(new AssemblyFilter(Assembly.GetExecutingAssembly().Location, "CommandServer.*.dll")));
            Configure.With()
                .CastleWindsorBuilder(container).BinarySerializer();
        }
    }

在我的 Messages 项目中,我有以下类(class):

[Serializable]
public class Command : IMessage
{
    public int Id { get; set; }
}

回到 CommandServer 项目,我有相应的 CommandHandler:

public class CommandMessageHandler : IHandleMessages<Command>
{
    public IBus Bus { get; set; }

    public void Handle(Command message)
    {
        Logger.Info(string.Format("Server 1 received Command with Id {0}.", message.Id));
    }

    private static readonly ILog Logger = LogManager.GetLogger(typeof(CommandMessageHandler));
}

不,除了 windsor 的东西 - 这根本不会影响它 - 与异步项目没有什么不同。然而,每当我运行 CommandServer 时,我都会得到以下输出:

Configuring eventstore persistence...

2011-07-12 16:33:32,524 [1] WARN  NServiceBus.Unicast.UnicastBus [(null)] <(null
)> - LocalAddress property of UnicastBusConfig not found. Using InputQueue prope
rty of MsmqTransportConfig instead. This will not be supported in the next versi
on.
2011-07-12 16:33:32,702 [1] INFO  NServiceBus.Hosting.Roles.RoleManager [(null)]
 <(null)> - Role NServiceBus.AsA_Server configured
2011-07-12 16:33:32,750 [1] INFO  NServiceBus.Host [(null)] <(null)> - Going to
activate profile: NServiceBus.Lite, NServiceBus.Host, Version=3.0.0.0, Culture=n
eutral, PublicKeyToken=9fc386479f8a226c
2011-07-12 16:33:35,749 [1] FATAL NServiceBus.Hosting.GenericHost [(null)] <(nul
l)> - System.InvalidOperationException: No destination could be found for messag
e type Messages.Command. Check the <MessageEndpointMapping> section of the confi
guration of this endpoint for an entry either for this specific message type or
for its assembly.
   at NServiceBus.Unicast.UnicastBus.Subscribe(Type messageType, Predicate`1 con
dition) in c:\Dev\NServiceBus\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line
 405
   at NServiceBus.Unicast.UnicastBus.Subscribe(Type messageType) in c:\Dev\NServ
iceBus\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 353
   at NServiceBus.Unicast.UnicastBus.PerformAutoSubcribe() in c:\Dev\NServiceBus
\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 754
   at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start(Action star
tupAction) in c:\Dev\NServiceBus\src\unicast\NServiceBus.Unicast\UnicastBus.cs:l
ine 739
   at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start() in c:\Dev
\NServiceBus\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 702
   at NServiceBus.Hosting.GenericHost.Start() in c:\Dev\NServiceBus\src\hosting\
NServiceBus.Hosting\GenericHost.cs:line 99

知道我做错了什么吗?

最佳答案

我想您会发现缺少 MessageEndpointMapping 部分

您使用的示例不执行任何 Bus.Send,因此不需要消息映射部分。

sample 中唯一的处理程序是一个 Bus.Return

另一种选择是将 Bus.Send 与您希望消息结束的队列名称一起使用。

关于c# - nservicebus启动错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6666960/

相关文章:

azure - 使用 Azure Function Cosmos DB Changefeed 触发器使用 NServiceBus 发布消息

spring-integration - 开源 ESB、Apache ServiceMix、Spring Integration?

amazon-ec2 - 在Amazon EC2上运行NServiceBus

c# - MVC Razor 路由建议

c# - ASP.NET 使用 Twitter 按钮登录 - 如果已经通过身份验证,如何停止要求用户进行身份验证?

c# - 我可以根据查找结果填充查找/选项集吗

c# - nServiceBus、Rhino 服务总线、MassTransit - 视频、演示、学习资源

Mulesoft 与使用 CDC 的 Salesforce Streaming API

java - 如何在 SOA 架构中使用事务和回滚

javascript - 从 List<string> C# 填充 JS 数组