public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IStorageAccessor accessor) { loggerFactory.AddDebug(); loggerFactory.AddSerilog(); var options = new BackgroundJobServerOptions { ServerName = Configuration.GetSection("HangfireSettings:ServerName").Value }; app.UseHangfireServer(options); app.UseHangfireDashboard(); if (env.IsEnvironment("dev")) { app.UseDeveloperExceptionPage(); } app.UseCors("CorsPolicy"); //app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions //{ // Authority = Configuration.GetSection("EndpointSettings:AuthEndpoint").Value, // RequireHttpsMetadata = false, //todo: should be true when enabled https // ApiName = "twitterapiservice", // CacheDuration = TimeSpan.FromMinutes(10) //}); //accessor.CancelRecurringJobs(); app.UseMvc(); }
public ConsumerJobBalancer(IStorageAccessor accessor, IConsumerJobManager jobManager, IOptions <HangfireSettings> hangfireOptions) { this.accessor = accessor; this.jobManager = jobManager; this.hangfireOptions = hangfireOptions; }
public TwitterJobBalancer(IStorageAccessor accessor, IOptions <TwitterApiSettings> settings, IOptions <AppSettings> appSettings, IOptions <HangfireSettings> hangfireSettings, IJobManager jobManager) { this.accessor = accessor; this.settings = settings; this.appSettings = appSettings; this.hangfireSettings = hangfireSettings; this.jobManager = jobManager; }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IStorageAccessor accessor) { loggerFactory.AddDebug(); loggerFactory.AddSerilog(); app.UseExceptionHandler(options => { options.Run( async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var ex = context.Features.Get <IExceptionHandlerFeature>(); if (ex != null) { var err = $"Error: {ex.Error.Message}{ex.Error.StackTrace}"; Log.Error(ex.Error, "Server Error", ex); await context.Response.WriteAsync(err).ConfigureAwait(false); } }); }); app.UseHangfireServer(new BackgroundJobServerOptions { ServerName = Configuration.GetSection("HangfireSettings:ServerName").Value, Queues = new[] { Configuration.GetSection("HangfireSettings:ServerName").Value } }); app.UseHangfireDashboard(); if (env.IsEnvironment("dev")) { app.UseDeveloperExceptionPage(); } app.UseCors("CorsPolicy"); //app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions //{ // Authority = Configuration.GetSection("EndpointSettings:AuthEndpoint").Value, // RequireHttpsMetadata = false, //todo: should be true when enabled https // ApiName = "ConsumerApiService", // CacheDuration = TimeSpan.FromMinutes(10) //}); // accessor.CancelRecurringJobs(); accessor.CancelRecurringJobs(); app.UseMvc(); }
public LocalArticleService() { storageAccessor = DependencyService.Resolve <IStorageAccessor>(); }