public async Task <IActionResult> LatestEventMessage() { var queueProcessor = new LiveUpdateService() { Enabled = true }; queueProcessor.SetupConnection(); var message = queueProcessor.Consume(); return(Ok(message)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc() .AddApplicationPart(typeof(Startup).Assembly) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddCors(options => { options.AddPolicy("DevCorsPolicy", builder => builder .WithOrigins("http://localhost:4200") .AllowAnyMethod() .AllowCredentials() .AllowAnyHeader() .Build() ); }); var appAuthConfig = StartUpHelper.GetEnvVariablesForAppAuthApi(Configuration); services.AddSingleton(appAuthConfig); var encryptionSettings = StartUpHelper.GetEncryptionSettings(Configuration); services.AddSingleton(encryptionSettings); var tokenSettings = StartUpHelper.GetTokenSettings(Configuration); services.AddSingleton(tokenSettings); ConfigureAuth(services, tokenSettings); services.AddSingleton <IAppAuthClient, AppAuthClient>(); services.AddScoped <IAppAuthApiService, AppAuthApiService>(); services.AddScoped <ApiServiceHelper>(); var queueProcessor = new LiveUpdateService() { Enabled = true }; queueProcessor.SetupConnection(); }