映射事件抛出

时间:2017-07-04 01:13:07

标签: rebus

我已经从程序集中映射了所有类。当启动Rebus时应该提及:

Mapped MyNamespace.Events.EmailSend -> Rebus/Test/Input

但是当我尝试使用以下代码在处理程序中提交消息时出现错误:

await _bus.Send(new EmailSend
{
    MyProperty = 1
}).ConfigureAwait(false);

我也尝试使用.Reply().SendLocal(),但这并没有帮助我摆脱下面的错误。

堆栈跟踪:

Rebus.Retry.ErrorTracking.InMemErrorTracker WARN (Thread #10): Unhandled exception 1 while handling message with ID a2c3b234-f519-4d86-bec9-715b2045ef94: Rebus.Exceptions.RebusApplicationException: Message with ID a2c3b234-f519-4d86-bec9-715b2045ef94 and type MyNamespace.Events.EmailSend, MyAssembly.Messaging.Models could not be dispatched to any handlers
at Rebus.Pipeline.Receive.DispatchIncomingMessageStep.<Process>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Rebus.Sagas.LoadSagaDataStep.<Process>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Rebus.Pipeline.Receive.ActivateHandlersStep.<Process>d__3.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.<Process>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Rebus.Retry.Simple.SimpleRetryStrategyStep.<DispatchWithTrackerIdentifier>d__7.MoveNext()

2 个答案:

答案 0 :(得分:1)

第一行确实说明了一切:

Rebus.Retry.ErrorTracking.InMemErrorTracker WARN (Thread #10): Unhandled exception 1 while handling message with ID a2c3b234-f519-4d86-bec9-715b2045ef94: Rebus.Exceptions.RebusApplicationException: Message with ID a2c3b234-f519-4d86-bec9-715b2045ef94 and type MyNamespace.Events.EmailSend, MyAssembly.Messaging.Models could not be dispatched to any handlers

注意最后一部分:

Message with ID a2c3b234-f519-4d86-bec9-715b2045ef94 and type MyNamespace.Events.EmailSend, MyAssembly.Messaging.Models could not be dispatched to any handlers

这意味着Rebus无法找到该消息的处理程序,即IHandleMessages<EmailSend>的实现。

如果您使用的是IoC容器,则此可以表示,虽然您可能已正确注册了处理程序类型,但其中一个依赖项无法解析。

如果你没有注册处理程序:我想这很明显:)

答案 1 :(得分:0)

使用.ConfigureAwait(true)调用_bus.Send(),似乎需要&#34; false&#34;从公交车上提交信息时。

哦,处理程序类是内部的。

猜猜其中一个是真正的问题 - 或者是一个组合......