Пример #1
0
        public static void UseSequin(this IAppBuilder app, SequinOptions options)
        {
            options.Validate();

            app.MapWhen(x => ShouldExecuteCommandPipeline(x, options.CommandEndpointPath), x =>
            {
                x.Use((ctx, next) =>
                {
                    ctx.Set("CommandEndpointPath", new PathString(options.CommandEndpointPath));
                    return(next());
                });

                x.Use <JsonExceptionHandler>(options.HideExceptionDetail);
                x.Use <DiscoverCommand>(options.CommandNameResolver, options.CommandRegistry, options.CommandFactory);

                if (options.CommandPipeline != null)
                {
                    foreach (var pipelineStage in options.CommandPipeline)
                    {
                        x.Use(pipelineStage.MiddlewareType, pipelineStage.Arguments);
                    }
                }

                x.Use <IssueCommand>(new ExclusiveHandlerCommandBus(options.HandlerFactory));
            });
        }
Пример #2
0
        public static void UseSequin(this IAppBuilder app, SequinOptions options)
        {
            options.Validate();

            app.MapWhen(x => ShouldExecuteCommandPipeline(x, options.CommandEndpointPath), x =>
            {
                x.Use((ctx, next) =>
                {
                    ctx.Set("CommandEndpointPath", new PathString(options.CommandEndpointPath));
                    return next();
                });

                x.Use<JsonExceptionHandler>(options.HideExceptionDetail);
                x.Use<DiscoverCommand>(options.CommandNameResolver, options.CommandRegistry, options.CommandFactory);

                if (options.CommandPipeline != null)
                {
                    foreach (var pipelineStage in options.CommandPipeline)
                    {
                        x.Use(pipelineStage.MiddlewareType, pipelineStage.Arguments);
                    }
                }

                x.Use<IssueCommand>(new ExclusiveHandlerCommandBus(options.HandlerFactory));
            });
        }
Пример #3
0
 private static void RegisterSequinOptionsMiddleware(SequinOptions options, IAppBuilder app)
 {
     app.Use((ctx, next) =>
     {
         ctx.Set("CommandEndpointPath", new PathString(options.CommandEndpointPath));
         return(next());
     });
 }
Пример #4
0
        public static void UseSequin(this IAppBuilder app, SequinOptions options)
        {
            options.Validate();
            RegisterSequinOptionsMiddleware(options, app);

            app.Use(typeof(HandleHttpOptions));
            app.MapWhen(x => ShouldExecuteCommandPipeline(x, options.CommandEndpointPath), x =>
            {
                RegisterPipelineMiddleware(options, x);
            });
        }
Пример #5
0
        private static void RegisterPipelineMiddleware(SequinOptions options, IAppBuilder app)
        {
            app.Use <DiscoverCommand>(options.CommandNameResolver, options.CommandRegistry, options.CommandFactory);

            if (options.CommandPipeline != null)
            {
                foreach (var pipelineStage in options.CommandPipeline)
                {
                    app.Use(pipelineStage.MiddlewareType, pipelineStage.Arguments);
                }
            }

            app.Use <IssueCommand>(new ExclusiveHandlerCommandBus(options.HandlerFactory), options.PostProcessor);
        }