Beispiel #1
0
        public static void UseExcess(this IAppBuilder app,
                                     __Scope scope,
                                     Action <ConcurrentAppSettings> initializeSettings = null,
                                     Action <IDistributedApp> initializeApp            = null,
                                     IEnumerable <Type> functional        = null,
                                     IEnumerable <FilterFunction> filters = null)
        {
            var settings = new ConcurrentAppSettings();

            initializeSettings?.Invoke(settings);

            var server = new DistributedApp(new ThreadedConcurrentApp(
                                                types: null,
                                                threadCount: settings.Threads,
                                                blockUntilNextEvent: settings.BlockUntilNextEvent));

            initializeApp?.Invoke(server);

            app.Use <ExcessOwinMiddleware>(server, scope, functional, filters);
            server.Start();
        }
Beispiel #2
0
        public static void UseExcess(this IAppBuilder builder,
                                     IEnumerable <Assembly> assemblies,
                                     ConcurrentAppSettings settings = null)
        {
            var scope = Application.Load(assemblies);

            UseExcess(builder,
                      scope,
                      initializeSettings: _settings =>
            {
                if (settings != null)
                {
                    _settings.From(settings);
                }
            },
                      initializeApp: app => Loader.FromAssemblies(app, assemblies, null),
                      functional: assemblies
                      .SelectMany(assembly => assembly
                                  .GetTypes()
                                  .Where(type => type.Name == "Functions")));
        }
Beispiel #3
0
 public static void UseExcess <T>(this IAppBuilder builder, ConcurrentAppSettings settings = null)
 {
     UseExcess(builder, new[] { typeof(T).Assembly });
 }
Beispiel #4
0
 public void From(ConcurrentAppSettings settings)
 {
     Threads             = settings.Threads;
     BlockUntilNextEvent = settings.BlockUntilNextEvent;
 }