Skip to content

Instantly share code, notes, and snippets.

@csharpfritz
Created August 9, 2011 13:55
Show Gist options
  • Save csharpfritz/1134105 to your computer and use it in GitHub Desktop.
Save csharpfritz/1134105 to your computer and use it in GitHub Desktop.
MassTransit bus config
IUnityContainer _Unity = // blah blah blah... configured Unity elsewhere
Bus.Initialize(sbc =>
{
sbc.UseMsmq();
sbc.VerifyMsmqConfiguration();
sbc.UseMulticastSubscriptionClient();
sbc.ReceiveFrom(queueName);
sbc.Subscribe(
subs =>
{
var types =
_Unity.Registrations.Where(
r =>
r.MappedToType.GetInterfaces().Contains(
typeof (IConsumer)));
foreach (var reg in types)
{
subs.Consumer(reg.MappedToType, t => _Unity.Resolve(t));
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment