我正在尝试将 Rebus 用作同一进程/AppDomain 中的内部总线。
我修改了Pub/Sub 示例并添加了 SameProcessHandler:
class SameProcessHandler : IHandleMessages<string>
{
public void Handle(string message)
{
Console.WriteLine("Same Process: {0}", message);
}
}
巴士启动后新增订阅:
Configure.With(adapter)
.Logging(l => l.ColoredConsole(minLevel: LogLevel.Warn))
.Transport(t => t.UseMsmqAndGetInputQueueNameFromAppConfig())
.Subscriptions(s => s.StoreInXmlFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "rebus_subscriptions.xml")))
.CreateBus()
.Start();
adapter.Bus.Subscribe<string>();
最后添加了目标队列(不确定是否需要):
<rebus inputQueue="pubsubsample.publisher.input"
errorQueue="pubsubsample.publisher.error"
workers="1" maxRetries="5">
<endpoints>
<!-- brute force ownership - all core .NET types are owned by our publisher :) -->
<add messages="mscorlib" endpoint="pubsubsample.publisher.input"/>
</endpoints>
</rebus>
但是我收到错误“Rebus 当前未配置端点映射机制”,我应该在订阅时指定目的地或更改配置。我宁愿使用配置,但如何?