Compare commits
No commits in common. "2ead6e8242d5cc4d1dc62bbb12cdba65042aac33" and "27b7452cd1e4493e734bbf0a0d6a12405ef96322" have entirely different histories.
2ead6e8242
...
27b7452cd1
@ -14,7 +14,7 @@ using Volo.Abp.Modularity;
|
|||||||
namespace JiShe.CollectBus.Migration;
|
namespace JiShe.CollectBus.Migration;
|
||||||
|
|
||||||
[DependsOn(
|
[DependsOn(
|
||||||
//typeof(CollectBusDomainModule),
|
typeof(CollectBusDomainModule),
|
||||||
typeof(CollectBusMigrationApplicationContractsModule),
|
typeof(CollectBusMigrationApplicationContractsModule),
|
||||||
typeof(AbpDddApplicationModule),
|
typeof(AbpDddApplicationModule),
|
||||||
typeof(AbpAutoMapperModule),
|
typeof(AbpAutoMapperModule),
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using JiShe.CollectBus.Migration.Host.HealthChecks;
|
//using Hangfire;
|
||||||
|
//using Hangfire.Redis.StackExchange;
|
||||||
|
using JiShe.CollectBus.Migration.Host.Hangfire;
|
||||||
|
using JiShe.CollectBus.Migration.Host.HealthChecks;
|
||||||
using JiShe.CollectBus.Migration.Host.Swaggers;
|
using JiShe.CollectBus.Migration.Host.Swaggers;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
@ -9,6 +12,7 @@ using StackExchange.Redis;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Volo.Abp.AspNetCore.Auditing;
|
using Volo.Abp.AspNetCore.Auditing;
|
||||||
using Volo.Abp.Auditing;
|
using Volo.Abp.Auditing;
|
||||||
|
using Volo.Abp.BackgroundJobs;
|
||||||
using Volo.Abp.Caching;
|
using Volo.Abp.Caching;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
@ -17,6 +21,33 @@ namespace JiShe.CollectBus.Migration.Host
|
|||||||
{
|
{
|
||||||
public partial class CollectBusMigrationHostModule
|
public partial class CollectBusMigrationHostModule
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Configures the hangfire.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The context.</param>
|
||||||
|
//private void ConfigureHangfire(ServiceConfigurationContext context)
|
||||||
|
//{
|
||||||
|
// var redisStorageOptions = new RedisStorageOptions()
|
||||||
|
// {
|
||||||
|
// Db = context.Services.GetConfiguration().GetValue<int>("Redis:HangfireDB")
|
||||||
|
// };
|
||||||
|
|
||||||
|
// Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
|
||||||
|
|
||||||
|
// context.Services.AddHangfire(config =>
|
||||||
|
// {
|
||||||
|
// config.UseRedisStorage(
|
||||||
|
// context.Services.GetConfiguration().GetValue<string>("Redis:Configuration"), redisStorageOptions)
|
||||||
|
// .WithJobExpirationTimeout(TimeSpan.FromDays(7));
|
||||||
|
// var delaysInSeconds = new[] { 10, 60, 60 * 3 }; // 重试时间间隔
|
||||||
|
// const int Attempts = 3; // 重试次数
|
||||||
|
// config.UseFilter(new AutomaticRetryAttribute() { Attempts = Attempts, DelaysInSeconds = delaysInSeconds });
|
||||||
|
// //config.UseFilter(new AutoDeleteAfterSuccessAttribute(TimeSpan.FromDays(7)));
|
||||||
|
// config.UseFilter(new JobRetryLastFilter(Attempts));
|
||||||
|
// });
|
||||||
|
// context.Services.AddHangfireServer();
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configures the JWT authentication.
|
/// Configures the JWT authentication.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -42,6 +42,7 @@ namespace JiShe.CollectBus.Migration.Host
|
|||||||
ConfigureSwaggerServices(context, configuration);
|
ConfigureSwaggerServices(context, configuration);
|
||||||
//ConfigureNetwork(context, configuration);
|
//ConfigureNetwork(context, configuration);
|
||||||
ConfigureJwtAuthentication(context, configuration);
|
ConfigureJwtAuthentication(context, configuration);
|
||||||
|
//ConfigureHangfire(context);
|
||||||
ConfigureAuditLog(context);
|
ConfigureAuditLog(context);
|
||||||
ConfigureCustom(context, configuration);
|
ConfigureCustom(context, configuration);
|
||||||
ConfigureHealthChecks(context, configuration);
|
ConfigureHealthChecks(context, configuration);
|
||||||
@ -83,9 +84,9 @@ namespace JiShe.CollectBus.Migration.Host
|
|||||||
options.DefaultModelsExpandDepth(-1);
|
options.DefaultModelsExpandDepth(-1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
app.UseAuditing();
|
//app.UseAuditing();
|
||||||
app.UseAbpSerilogEnrichers();
|
app.UseAbpSerilogEnrichers();
|
||||||
//app.UseUnitOfWork();
|
app.UseUnitOfWork();
|
||||||
//app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
//app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
||||||
//{
|
//{
|
||||||
// IgnoreAntiforgeryToken = true
|
// IgnoreAntiforgeryToken = true
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
using Hangfire.Common;
|
||||||
|
using Hangfire.States;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Migration.Host.Hangfire
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 重试最后一次
|
||||||
|
/// </summary>
|
||||||
|
public class JobRetryLastFilter : JobFilterAttribute, IElectStateFilter
|
||||||
|
{
|
||||||
|
private int RetryCount { get; }
|
||||||
|
|
||||||
|
public JobRetryLastFilter(int retryCount)
|
||||||
|
{
|
||||||
|
RetryCount = retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OnStateElection(ElectStateContext context)
|
||||||
|
{
|
||||||
|
var retryAttempt = context.GetJobParameter<int>("RetryCount");
|
||||||
|
if (RetryCount == retryAttempt)
|
||||||
|
{
|
||||||
|
Log.Error("最后一次重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -46,8 +46,6 @@
|
|||||||
<!--<PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="8.3.3" />-->
|
<!--<PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="8.3.3" />-->
|
||||||
|
|
||||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.3" />
|
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.3" />
|
||||||
|
|
||||||
<PackageReference Include="Volo.Abp.Core" Version="8.3.3" />
|
|
||||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.3" />
|
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.3" />
|
||||||
<!--<PackageReference Include="Hangfire.HttpJob" Version="3.8.5" />
|
<!--<PackageReference Include="Hangfire.HttpJob" Version="3.8.5" />
|
||||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user