IoC, Containers, and NServiceBus confusion

Posted by andy on Stack Overflow See other posts from Stack Overflow or by andy
Published on 2010-05-19T00:31:38Z Indexed on 2010/05/19 0:40 UTC
Read the original article Hit count: 342

Hey guys, here's 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, 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?

cheers

andy

© Stack Overflow or respective owner

Related posts about nservicebus

Related posts about design-patterns