How to get instance or setup in StructureMap IBus in the worker role where I already use AsA_Worker, UsingTransport<AzureServiceBus>

StackOverflow https://stackoverflow.com/questions/19857969

문제

I have a problem. I setup azure worker role which use NServiceBus with Azure Service Bus:

public class Host : NServiceBus.Hosting.Azure.RoleEntryPoint
    {    

        public override bool OnStart()
        {
            RegisterByObjectFactory.Register();

            ServicePointManager.DefaultConnectionLimit = 12;

            return base.OnStart();
        }
...

In my worker role I use services which have parameters IBus.

Spent 3 days to figure out how to do it but still without success.

If I try to inject the NserviceBus in the RegisterByObjectFactory then on row "return base.OnStart();" I receive the error that the ConnectionString property was locked :(

Please help.

도움이 되었습니까?

해결책

Onstart is probably a bit to early in the lifecycle of nservicebus to get hold of the bus.

Implement a class with the interface IWantToRunWhenTheBusStartsAndStops and you should have access to the fully initialized IBus instance there...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top