Skip to content

Instantly share code, notes, and snippets.

@ryankelley
Created May 27, 2010 20:35
Show Gist options
  • Save ryankelley/416304 to your computer and use it in GitHub Desktop.
Save ryankelley/416304 to your computer and use it in GitHub Desktop.
public FieldBookServiceRunner()
{
serviceBus = ObjectFactory.GetInstance<IServiceBus>();
using (serviceBus)
{
SubscribeConsumers(ObjectFactory.Container, serviceBus);
Console.ReadLine();
_log.Info("Stopping Service Runner");
}
}
private static void SubscribeConsumers(IContainer container, IServiceBus bus)
{
var consumerInstances = container.Model.PluginTypes
.Where(p => typeof(Consumes<>.All).IsAssignableFrom(p.PluginType))
.SelectMany(p => p.Instances);
consumerInstances.Each(type => bus.Subscribe(type.ConcreteType));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment