Ejemplo n.º 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));
            });
        }
Ejemplo n.º 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));
            });
        }
Ejemplo n.º 3
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);
            });
        }