0

I am using NServiceBus is an azure worker role via convention by having configuration in app.config and azure Queue details in .csdef.

I have a rest service that accesses the IBus by doing this:

Configure.Instance.Builder.Build<IBus>()

and works fine!

I have a class that implements IWantToRunAtStartup where I do the configure bootstrapper as follows:

    Bootstrapper.With.StructureMap()
        .UsingAutoRegistration()
        .And.AutoMapper().Start();

I'm losing the IBus reference if I then use the bootstrap container:

Configure.Instance.StructureMapBuilder((IContainer) Bootstrapper.Container);

How do I use Bootsrtrapper.StructureMap and NServiceBus?

fmendez
  • 7,250
  • 5
  • 36
  • 35

1 Answers1

1

Telling us which container you want to use needs to be done from a IConfigureThisEndpoint and IWantCustomInitialization class, example:

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
    public void Init()
    {
        Configure.With()
            .StructureMapBuilder((IContainer) Bootstrapper.Container);
    }
}
John Simons
  • 4,288
  • 23
  • 41
  • Hi John - must be a single class and not two seperate, so as above but also the serializer as .AzureMessageQueue().JsonSerializer(); Great cheers. – Paul Harding Mar 22 '13 at 10:14