public static IMicropartBuilder UseLogOfNLog(this IMicropartBuilder app) { var microServiceStatusManager = app.ApplicationServices.GetService <IMicropartStatusManager>(); var micropartInfoOfNLog = microServiceStatusManager.UpdateStatus <MicropartInfoOfNLog>(MicropartType.Log); if (micropartInfoOfNLog.IsEnabled) { var microserviceTraceInfoManager = app.ApplicationServices.GetService <IMicroserviceTraceInfoManager>(); TraceInfoLayoutRender.GetTraceInfo = () => microserviceTraceInfoManager.GetCurrentTraceInfo(); var loggerFactory = app.ApplicationServices.GetService <ILoggerFactory>(); loggerFactory.AddNLog(new NLogProviderOptions { CaptureMessageTemplates = true, CaptureMessageProperties = true }); ConfigurationItemFactory .Default .LayoutRenderers .RegisterDefinition("traceInfo", typeof(TraceInfoLayoutRender)); loggerFactory.ConfigureNLog("nlog.config"); } return(app); }
public static IMicropartBuilder UseServiceCenterOfConsul( this IMicropartBuilder micropartBuilder, Action <MicropartOfServiceCenterAConsulBuilder> innerBuilderAction ) { innerBuilderAction(new MicropartOfServiceCenterAConsulBuilder(micropartBuilder)); return(micropartBuilder); }
public static IMicropartBuilder UseRabbitMqAsEventBus(this IMicropartBuilder app) { var micropartOfEventBusStartup = app.ApplicationServices.GetService <IMicropartOfEventBusStartup>(); var lifetime = app.ApplicationServices.GetService <IAppLifetime>(); lifetime.ApplicationStarted.Register(() => micropartOfEventBusStartup.Start()); lifetime.ApplicationStopped.Register(micropartOfEventBusStartup.Stop); return(app); }
public static IMicropartBuilder UseCallTraceOfZipkin(this IMicropartBuilder app) { var appConfigurationManager = app.ApplicationServices.GetService <IAppConfigurationManager>(); appConfigurationManager.MonitorConfig <AppConfigOfZipkin>(); var micropartOfCallTreeStartup = app.ApplicationServices.GetService <IMicropartOfCallTreeStartup>(); var lifetime = app.ApplicationServices.GetService <IAppLifetime>(); lifetime.ApplicationStarted.Register(() => micropartOfCallTreeStartup.Start()); lifetime.ApplicationStopped.Register(micropartOfCallTreeStartup.Stop); return(app); }
public static IMicropartBuilder UseHttpHealthCheckOfAspNetCore(this IMicropartBuilder micropartBuilder, IApplicationBuilder app) { var httpHealtheCheck = new HttpHealthCheck(); app.Map(httpHealtheCheck.HealthCheckUrl, builder => builder.Run(async context => { await context.Response.WriteAsync("OK1"); })); app.ApplicationServices.GetService <IMicropartOfServiceCenter>().RegisterService(); var httpRequestFilter = app.ApplicationServices.GetService <IMicroserviceFilterManager <HttpRequestFilter, HttpRequest> >(); httpRequestFilter.AddFilter(new HttpRequestFilterOfHealthCheck()); return(micropartBuilder); }
public static IMicropartBuilder UseCallTraceOfZipkin(this IMicropartBuilder micropartBuilder, Action <MicropartOfCallChainAsZipkinBuilder> micropartOfCallChainAsZipkinBuilder) { micropartBuilder.UseCallTraceOfZipkin(); micropartOfCallChainAsZipkinBuilder(new MicropartOfCallChainAsZipkinBuilder()); return(micropartBuilder); }
public MicropartOfServiceCenterAConsulBuilder(IMicropartBuilder micropartBuilder) { _micropartBuilder = micropartBuilder; }
public static IMicropartBuilder UseServiceCenterOfConsul(this IMicropartBuilder micropartBuilder) { return(micropartBuilder); }
public static void UseConfigurationCenterOfConsul(this IMicropartBuilder app) { }