Beispiel #1
0
        internal Task FindRoutes(JasperRuntime runtime, JasperRegistry registry, PerfTimer timer)
        {
            var applicationAssembly = registry.ApplicationAssembly;
            var generation          = registry.CodeGeneration;

            return(FindActions(applicationAssembly).ContinueWith(t =>
            {
                timer.Record("Find Routes", () =>
                {
                    var actions = t.Result;
                    foreach (var methodCall in actions)
                    {
                        Routes.AddRoute(methodCall);
                    }

                    if (_transport.ListeningEnabled)
                    {
#pragma warning disable 4014
                        Routes.AddRoute <TransportEndpoint>(nameof(TransportEndpoint.put__messages),
                                                            _transport.RelativeUrl).Route.HttpMethod = "PUT";


                        Routes.AddRoute <TransportEndpoint>(nameof(TransportEndpoint.put__messages_durable),
                                                            _transport.RelativeUrl.AppendUrl("durable")).Route.HttpMethod = "PUT";

#pragma warning restore 4014
                    }
                });

                var rules = timer.Record("Fetching Conneg Rules",
                                         () => runtime.Container.QuickBuild <ConnegRules>());

                timer.Record("Build Routing Tree", () => { Routes.BuildRoutingTree(rules, generation, runtime); });
            }));
        }
Beispiel #2
0
 public Task Activate(JasperRuntime runtime, IGenerationConfig generation)
 {
     return(Task.Factory.StartNew(() =>
     {
         Routes.BuildRoutingTree(generation, runtime.Container);
     }));
 }
Beispiel #3
0
        // Call this from the activator
        internal Task BuildRouting(IContainer container, JasperGenerationRules generation)
        {
            if (!Enabled)
            {
                return(Task.CompletedTask);
            }

            return(_findActions.ContinueWith(t => { Routes.BuildRoutingTree(generation, container); }));
        }
Beispiel #4
0
        internal Task FindRoutes(JasperRuntime runtime, JasperRegistry registry, PerfTimer timer)
        {
            var applicationAssembly = registry.ApplicationAssembly;
            var generation          = registry.CodeGeneration;

            return(FindActions(applicationAssembly).ContinueWith(t =>
            {
                timer.Record("Find Routes", () =>
                {
                    var actions = t.Result;
                    foreach (var methodCall in actions)
                    {
                        Routes.AddRoute(methodCall);
                    }
                });

                var rules = timer.Record("Fetching Conneg Rules",
                                         () => runtime.Container.QuickBuild <ConnegRules>());

                timer.Record("Build Routing Tree", () => { Routes.BuildRoutingTree(rules, generation, runtime); });
            }));
        }