Question

I'm creating an NServicebus hosted process and want to initialize my IOC container as well as create an instance of the Self-Hosted Web API. I'm trying to understand the conceptual differences between implementing the IWantToRunAtStartup and IWantToRunWhenTheBusStarts interfaces, so I can place my initialization code in the appropriate place. Which interface would be better to implement for these initializations?

I believe I would use IWantToRunAtStartup for the web api since it has the stop interface that will be needed when the process shuts down. But since the interface says it is Dependency injected should the IOC container be initialized in the IWantToRunWhenTheBusStarts or somewhere else?

Was it helpful?

Solution

In V3 use:

IWantToRunWhenTheBusStarts 

In V4 we have introduced a new interface called:

IWantToRunWhenBusStartsAndStops

This new interface is also used in v5.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top