1
我想在同一個進程/ AppDomain中使用Rebus作爲內部總線。同樣的過程訂閱在Rebus中是不可能的
我已經修改了Pub/Sub sample,並增加了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目前沒有配置wi一個端點映射機制「,我應該在訂閱時指定一個目的地或更改配置。我寧願使用配置,但如何?
謝謝......我是......盲目:) – Lybecker 2013-03-16 11:06:58