Skip to content

Instantly share code, notes, and snippets.

@stefansedich
Created September 13, 2011 10:13
Show Gist options
  • Select an option

  • Save stefansedich/1213534 to your computer and use it in GitHub Desktop.

Select an option

Save stefansedich/1213534 to your computer and use it in GitHub Desktop.
public static void Main(string[] args)
{
var builder = new ContainerBuilder();
// Register our service bus, this could probably be a module.
builder.Register(c =>
ServiceBusFactory.New(sbc =>
{
var scope = c.Resolve<ILifetimeScope>();
//other configuration options
sbc.Subscribe(sbsc => sbsc.LoadFrom(scope));
})
).SingleInstance();
// Register your consumers, you should probably use a module for this.
builder.RegisterType<YourConsumer>().As<IConsumer>();
// Create the container
var container = builder.Build();
}
* We recommend that most of this type of code be placed in an Autofac Module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment