NserviceBus 6使用RabbitMQTransport无法正常工作

时间:2018-04-10 20:22:09

标签: rabbitmq nservicebus rabbitmq-exchange nservicebus6

我们使用的是NSB v6.4.3,NServiceBus.RabbitMQ v4.4.1,RabbitMQ.Client v5.0.1。我的队列是自动创建的,但是当我向队列发送消息时,我收到了这个错误。

"标题":"频道已关闭:AMQP关闭原因,由Peer发起,代码= 404,text = \" NOT_FOUND - 无交换&# 39; SelfDriving.NServicebus'在vhost' /' \",classId = 60,methodId = 40,cause =。",             "细节":" at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在NServiceBus.MutateOutgoingTransportMessageBehavior.d__1.MoveNext()\ r \ n ---从以前的位置堆栈跟踪,其中引发异常--- \ r \ n结束在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在NServiceBus.SerializeMessageConnector.d__1.MoveNext()\ r \ n ---从抛出异常的上一个位置的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter .ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在NServiceBus.MutateOutgoingMessageBehavior.d__1.MoveNext()\ r \ n ---堆栈跟踪结束抛出异常的先前位置--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在NServiceBus.UnicastSendRouterConnector.d__1.MoveNext() \ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束---在System.Runtime.CompilerServices上的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n中的\ r \ n。 SystemAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.GetResult()\ r \ n在SelfDriving.Api.Controllers.BasicController.d__19.MoveNext()中的C:\ Source \ innovate \ self_driving_ideas .cs \ SelfDriving.Api \ Controllers \ BasicController.cs:第61行\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNoti在C:\ Source \ innovate \ self_driving_ideas.cs中的SelfDriving.Api.Controllers.FiltersController.d__3.MoveNext()的System.Runtime.CompilerServices.TaskAwaiter.GetResult()\ r \ n中的fication(任务任务)\ r \ n \ SelfDriving.Api \ Controllers \ FiltersController.cs:第188行\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.GetResult()\ r \ n在SelfDriving.Api.Controllers.FiltersController.d__2 .MoveNext()在C:\ Source \ innovate \ self_driving_ideas.cs \ SelfDriving.Api \ Controllers \ FiltersController.cs:168行\ r \ n ---从先前位置抛出异常的堆栈跟踪结束--- r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDe在System.Threading.Tasks.TaskHelpersExtensions.d__3`1.MoveNext()\ r \ n中的buggerNotification(任务任务)\ r \ n \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n ()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束---在System.Runtime的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n中的\ r \ n。 CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext(个)\ r \ n ---从先前的位置在那里引发异常堆栈跟踪的结尾--- \ r \ n在System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\ r \ n ---从上一个位置的堆栈跟踪结束在被抛出--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在的System.Web .Http.Filters.ActionFilterAttribute.d__0.MoveNext()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)个)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务个)\ r \ n在System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext(个)\ r \ n ---栈跟踪的结尾从先前的位置在那里引发异常--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()",             "代码":" System.Exception"

当我使用MsmqTransport时,我没有任何问题 这是我的配置代码

    config = new EndpointConfiguration("SelfDriving.NServiceBus");
config.AssemblyScanner();
config.UsePersistence<InMemoryPersistence>();
config.LimitMessageProcessingConcurrencyTo(1);
var recoverability = config.Recoverability();
recoverability.Immediate( customizations: immediate => { immediate.NumberOfRetries(3);});
DefaultFactory defaultFactory = LogManager.Use<DefaultFactory>();
defaultFactory.Directory("c:\storage\Bus");
defaultFactory.Level(LogLevel.Error);
config.SendFailedMessagesTo("error");
config.AuditProcessedMessagesTo("audit", TimeSpan.FromDays(7));
var rabbitMQTransport = config.UseTransport<RabbitMQTransport>().Transactions(TransportTransactionMode.ReceiveOnly);
var rabbitMQRouting = rabbitMQTransport.Routing();
rabbitMQRouting.RouteToEndpoint(assembly: Assembly.GetAssembly(typeof (BasicMessage)),destination: "SelfDriving.NServiceBus");
config.SendOnly();
var endpointInstance = Endpoint.Start(config).GetAwaiter().GetResult();

2 个答案:

答案 0 :(得分:0)

您正在将端点配置为SendOnly。这意味着没有传入队列。但是,您还可以配置路由以将BasicMessage所在的程序集内的所有消息发送到此完全相同的端点。

造成问题no exchange 'SelfDriving.NServicebus'

的原因

如果删除SendOnly选项,它可能会起作用。

答案 1 :(得分:0)

发生此问题是因为RabbitMQ区分大小写,我将其发送到 SelfDriving.NServicebus ,这是一个错误的终点,而不是 SelfDriving.NServicebus 更改端点名称

后,此问题立即得到解决