Commit 8d228115 by pengjinyang

提交

parent 2150d193
...@@ -4,6 +4,7 @@ using Domain.TakeStock.Repository; ...@@ -4,6 +4,7 @@ using Domain.TakeStock.Repository;
using EasyNetQ; using EasyNetQ;
using EasyNetQ.AutoSubscribe; using EasyNetQ.AutoSubscribe;
using Hangfire; using Hangfire;
using Hangfire.MemoryStorage;
using Hangfire.MySql; using Hangfire.MySql;
using IService.TakeStock; using IService.TakeStock;
using MessageQueue; using MessageQueue;
...@@ -32,11 +33,11 @@ namespace TakeStock.API ...@@ -32,11 +33,11 @@ namespace TakeStock.API
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
Redis = ConnectionMultiplexer.Connect(Configuration.GetConnectionString("Redis")); //Redis = ConnectionMultiplexer.Connect(Configuration.GetConnectionString("Redis"));
} }
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
public static ConnectionMultiplexer Redis; //public static ConnectionMultiplexer Redis;
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
...@@ -73,7 +74,10 @@ namespace TakeStock.API ...@@ -73,7 +74,10 @@ namespace TakeStock.API
services.AddHttpClient(); services.AddHttpClient();
// Add Hangfire services. // Add Hangfire services.
services.AddHangfire(configuration => configuration.UseRedisStorage(Redis)); services.AddHangfire(config =>
{
config.UseMemoryStorage();
});
// Add the processing server as IHostedService // Add the processing server as IHostedService
services.AddHangfireServer(); services.AddHangfireServer();
...@@ -111,7 +115,6 @@ namespace TakeStock.API ...@@ -111,7 +115,6 @@ namespace TakeStock.API
//dbContext.Migration(); //dbContext.Migration();
//app.UseSubscribe("TakeStockService", AppDomain.CurrentDomain.GetAssemblies().Single(a => a.GetName().Name == "Service")); //app.UseSubscribe("TakeStockService", AppDomain.CurrentDomain.GetAssemblies().Single(a => a.GetName().Name == "Service"));
} }
public void RegisterHttpClient(IServiceCollection services) public void RegisterHttpClient(IServiceCollection services)
......
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.3" /> <PackageReference Include="Hangfire.AspNetCore" Version="1.7.3" />
<PackageReference Include="Hangfire.Dashboard.Authorization" Version="2.1.0" /> <PackageReference Include="Hangfire.Dashboard.Authorization" Version="2.1.0" />
<PackageReference Include="Hangfire.Dashboard.Dark" Version="1.0.6" /> <PackageReference Include="Hangfire.Dashboard.Dark" Version="1.0.6" />
<PackageReference Include="Hangfire.MemoryStorage" Version="1.6.3" />
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.0" /> <PackageReference Include="Hangfire.MySqlStorage" Version="2.0.0" />
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.0" /> <PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.0" />
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment