private async Task <ServiceRegistry> bootstrap(JasperRegistry registry) { var calls = await Handlers.FindCalls(registry).ConfigureAwait(false); _graph = new HandlerGraph(); _graph.AddRange(calls); _graph.Add(HandlerCall.For <SubscriptionsHandler>(x => x.Handle(new SubscriptionsChanged()))); _graph.Group(); Handlers.ApplyPolicies(_graph); // Because the built in DI container is too stupid to just build out concrete types foreach (var type in _graph.Chains.SelectMany(x => x.Handlers).Select(x => x.HandlerType).Distinct()) { Services.AddScoped(type, type); } Services.AddSingleton(_graph); Services.AddSingleton <IChannelGraph>(_channels); Services.AddTransient <ServiceBusActivator>(); if (registry.Logging.UseConsoleLogging) { Services.For <IBusLogger>().Use <ConsoleBusLogger>(); } Services.ForSingletonOf <IDelayedJobProcessor>().UseIfNone <InMemoryDelayedJobProcessor>(); return(Services); }
private async Task <ServiceRegistry> bootstrap(JasperRegistry registry) { var calls = await Handlers.FindCalls(registry).ConfigureAwait(false); _graph = new HandlerGraph(); _graph.AddRange(calls); _graph.Add(HandlerCall.For <SubscriptionsHandler>(x => x.Handle(new SubscriptionsChanged()))); _graph.Group(); Handlers.ApplyPolicies(_graph); Services.AddSingleton(_graph); Services.AddSingleton <IChannelGraph>(_channels); Services.AddSingleton <ILocalWorkerSender>(_localWorker); Services.AddTransient <ServiceBusActivator>(); if (registry.Logging.UseConsoleLogging) { Services.For <IBusLogger>().Use <ConsoleBusLogger>(); Services.For <ITransportLogger>().Use <ConsoleTransportLogger>(); } Services.ForSingletonOf <IDelayedJobProcessor>().UseIfNone <InMemoryDelayedJobProcessor>(); return(Services); }
internal void StartCompiling(JasperOptionsBuilder registry) { Compiling = Handling.Source.FindCalls(registry).ContinueWith(t => { var calls = t.Result; if (calls != null && calls.Any()) { Graph.AddRange(calls); } Graph.Group(); Handling.ApplyPolicies(Graph, registry.CodeGeneration); }); }
private async Task <Registry> bootstrap(JasperRegistry registry) { var calls = await Handlers.FindCalls(registry).ConfigureAwait(false); _graph = new HandlerGraph(); _graph.AddRange(calls); _graph.Group(); Policies.Apply(_graph); Services.For <HandlerGraph>().Use(_graph); Services.For <ChannelGraph>().Use(Channels); if (registry.Logging.UseConsoleLogging) { Services.For <IBusLogger>().Add <ConsoleBusLogger>(); } return(Services); }