Skip to content

Instantly share code, notes, and snippets.

@drusellers
Forked from mikeobrien/gist:606294
Created October 1, 2010 14:41
Show Gist options
  • Save drusellers/606297 to your computer and use it in GitHub Desktop.
Save drusellers/606297 to your computer and use it in GitHub Desktop.
public class Program
{
public static void Main(string[] args)
{
// ...
var loadmailConfig = RunnerConfigurator.New(x =>
{
x.ConfigureService<TimerController>(s =>
{
s.Named("DunderMifflinLoadmail");
s.HowToBuildService(name =>
new TimerController(name,
Registry.Current,
r => r.Resolve<Loadmail>().Run(),
Registry.Current.Resolve<IConfiguration>().Sendmail.Frequency,
logProvider));
s.WhenStarted(controller => controller.Start());
s.WhenStopped(controller => controller.Stop());
});
x.SetDescription("Queues mailings.");
x.SetDisplayName("DunderMifflin Loadmail");
x.SetServiceName("DunderMifflinLoadmail");
});
var sendmailConfig = RunnerConfigurator.New(x =>
{
x.ConfigureService<TimerController>(s =>
{
s.Named(serviceAlias);
s.HowToBuildService(name =>
new TimerController(string.Format("{0} ({1})", serviceAlias, serverId),
Registry.Current,
r => r.Resolve<Sendmail>().Run(serverId),
Registry.Current.Resolve<IConfiguration>().Sendmail.Frequency,
logProvider));
s.WhenStarted(controller => controller.Start());
s.WhenStopped(controller => controller.Stop());
});
x.SetDescription("Processes and sends mailings.");
x.SetDisplayName("DunderMifflin Sendmail");
x.SetServiceName(serviceAlias);
});
Runner.Host(??, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment