开发者

IoC, Containers, and NServiceBus confusion

Here is my setup

  • Castle Windsor is my container
  • NServiceBus is itself using it's own container internally, Spring by default
  • I'm implementing the PubSub config.

Ok, if I have my Bus.Publish happening within my IWantToRunAtStartup class开发者_如何学Python, then everything is fine. As a test for example on Run() we can start a timer and it'll go into a Service style loop.

However, what if I want to abstract NServiceBus from my app, and have my app go:

new CustomPulisherClass().Notify(ISomeMessage msg);

In this situation, how do I implement CustomPublisherClass.

My confusion is coming from the fact that NServiceBus is already running as a Service, it's already been "Started". How to I get at the correct instance of the Bus object?


You should configure NServiceBus to use Windsor as the internal container:

http://sourceforge.net/apps/mediawiki/nservicebus/index.php?title=Additional_containers

If you do that the correct IBus will be available in your instance of Windsor

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜