Github user AndyPook commented on the issue: https://github.com/apache/lucenenet/pull/209 just playing... here's how a middleware might look ```csharp public class Startup { // usual boiler plate // add some method that bootstraps the index and replication service public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseLuceneReplicator("/_replicator", "replicaService123"); app.UseMvc(); } } // these bits live in Lucene.Net.Replicator.AspNetCore public static class LuceneReplicatorMiddlewareExtensions { public static IApplicationBuilder UseLuceneReplicator(this IApplicationBuilder builder, PathString prefix, object replicaService) { return builder.Map(prefix, app => app.UseMiddleware<LuceneReplicatorMiddleware>(replicaService)); } } public class LuceneReplicatorMiddleware { private readonly RequestDelegate next; private readonly object replicaService; public LuceneReplicatorMiddleware(RequestDelegate next, object replicaService) { this.next = next; this.replicaService= replicaService; } public async Task Invoke(HttpContext context) { var req = context.Request; await context.Response.WriteAsync($"<p>{DateTime.Now.ToString()}</p>"); await context.Response.WriteAsync($"<p>replicaService={replicaService.ToString()}</p>"); await context.Response.WriteAsync($"<p>path={req.Path}</p>"); await context.Response.WriteAsync($"<ul>"); foreach(var q in req.Query) await context.Response.WriteAsync($"<li>{q.Key}={q.Value}</li>"); await context.Response.WriteAsync($"</ul>"); } } ``` ```app.Map``` intercepts requests with that prefix (they call it "branching the request pipeline") Where I've used "replicaService123" is just a demo of how to pass stuff into the middleware. You'd substitute the ```ReplicationService```. Then ```Invoke``` could be as simple as ```replicaService.Perform(context.Request, context.Response)```. But it might be better to pull the exception handling part out into the middleware and just pass the response stream into the service. Note: ```req.Path``` is just the part coming after the prefix Anyway, just an idea
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---