BackgroundJobs To AbpBackgroundJobs

pull/1919/head
Yunus Emre Kalkan 5 years ago
parent 8146c20a57
commit 9b6b49ff2d

@ -4,7 +4,7 @@ using System.Collections.Immutable;
namespace Volo.Abp.BackgroundJobs
{
public class BackgroundJobOptions
public class AbpBackgroundJobOptions
{
private readonly Dictionary<Type, BackgroundJobConfiguration> _jobConfigurationsByArgsType;
private readonly Dictionary<string, BackgroundJobConfiguration> _jobConfigurationsByName;
@ -15,7 +15,7 @@ namespace Volo.Abp.BackgroundJobs
/// </summary>
public bool IsJobExecutionEnabled { get; set; } = true;
public BackgroundJobOptions()
public AbpBackgroundJobOptions()
{
_jobConfigurationsByArgsType = new Dictionary<Type, BackgroundJobConfiguration>();
_jobConfigurationsByName = new Dictionary<string, BackgroundJobConfiguration>();

@ -29,7 +29,7 @@ namespace Volo.Abp.BackgroundJobs
}
});
services.Configure<BackgroundJobOptions>(options =>
services.Configure<AbpBackgroundJobOptions>(options =>
{
foreach (var jobType in jobTypes)
{

@ -10,9 +10,9 @@ namespace Volo.Abp.BackgroundJobs
{
public ILogger<BackgroundJobExecuter> Logger { protected get; set; }
protected BackgroundJobOptions Options { get; }
protected AbpBackgroundJobOptions Options { get; }
public BackgroundJobExecuter(IOptions<BackgroundJobOptions> options)
public BackgroundJobExecuter(IOptions<AbpBackgroundJobOptions> options)
{
Options = options.Value;

@ -5,12 +5,12 @@ namespace Volo.Abp.BackgroundJobs.Hangfire
{
public class HangfireJobExecutionAdapter<TArgs>
{
protected BackgroundJobOptions Options { get; }
protected AbpBackgroundJobOptions Options { get; }
protected IServiceScopeFactory ServiceScopeFactory { get; }
protected IBackgroundJobExecuter JobExecuter { get; }
public HangfireJobExecutionAdapter(
IOptions<BackgroundJobOptions> options,
IOptions<AbpBackgroundJobOptions> options,
IBackgroundJobExecuter jobExecuter,
IServiceScopeFactory serviceScopeFactory)
{

@ -24,7 +24,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
public ILogger<JobQueue<TArgs>> Logger { get; set; }
protected BackgroundJobOptions BackgroundJobOptions { get; }
protected AbpBackgroundJobOptions AbpBackgroundJobOptions { get; }
protected RabbitMqBackgroundJobOptions RabbitMqBackgroundJobOptions { get; }
protected IChannelPool ChannelPool { get; }
protected IRabbitMqSerializer Serializer { get; }
@ -35,21 +35,21 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected bool IsDiposed { get; private set; }
public JobQueue(
IOptions<BackgroundJobOptions> backgroundJobOptions,
IOptions<RabbitMqBackgroundJobOptions> rabbitMqBackgroundJobOptions,
IOptions<AbpBackgroundJobOptions> backgroundJobOptions,
IOptions<RabbitMqBackgroundJobOptions> rabbitMqAbpBackgroundJobOptions,
IChannelPool channelPool,
IRabbitMqSerializer serializer,
IBackgroundJobExecuter jobExecuter,
IServiceScopeFactory serviceScopeFactory)
{
BackgroundJobOptions = backgroundJobOptions.Value;
RabbitMqBackgroundJobOptions = rabbitMqBackgroundJobOptions.Value;
AbpBackgroundJobOptions = backgroundJobOptions.Value;
RabbitMqBackgroundJobOptions = rabbitMqAbpBackgroundJobOptions.Value;
Serializer = serializer;
JobExecuter = jobExecuter;
ServiceScopeFactory = serviceScopeFactory;
ChannelPool = channelPool;
JobConfiguration = BackgroundJobOptions.GetJob(typeof(TArgs));
JobConfiguration = AbpBackgroundJobOptions.GetJob(typeof(TArgs));
QueueConfiguration = GetOrCreateJobQueueConfiguration();
Logger = NullLogger<JobQueue<TArgs>>.Instance;
@ -85,7 +85,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
{
CheckDisposed();
if (!BackgroundJobOptions.IsJobExecutionEnabled)
if (!AbpBackgroundJobOptions.IsJobExecutionEnabled)
{
return;
}
@ -129,7 +129,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
var result = QueueConfiguration.Declare(ChannelAccessor.Channel);
Logger.LogDebug($"RabbitMQ Queue '{QueueConfiguration.QueueName}' has {result.MessageCount} messages and {result.ConsumerCount} consumers.");
if (BackgroundJobOptions.IsJobExecutionEnabled)
if (AbpBackgroundJobOptions.IsJobExecutionEnabled)
{
Consumer = new EventingBasicConsumer(ChannelAccessor.Channel);
Consumer.Received += MessageReceived;

@ -15,10 +15,10 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected IServiceProvider ServiceProvider { get; }
protected BackgroundJobOptions Options { get; }
protected AbpBackgroundJobOptions Options { get; }
public JobQueueManager(
IOptions<BackgroundJobOptions> options,
IOptions<AbpBackgroundJobOptions> options,
IServiceProvider serviceProvider)
{
ServiceProvider = serviceProvider;

@ -17,7 +17,7 @@ namespace Volo.Abp.BackgroundJobs
{
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var options = context.ServiceProvider.GetRequiredService<IOptions<BackgroundJobOptions>>().Value;
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value;
if (options.IsJobExecutionEnabled)
{
context.ServiceProvider

@ -11,7 +11,7 @@ namespace Volo.Abp.BackgroundJobs
{
public class BackgroundJobWorker : PeriodicBackgroundWorkerBase, IBackgroundJobWorker
{
protected BackgroundJobOptions JobOptions { get; }
protected AbpBackgroundJobOptions JobOptions { get; }
protected BackgroundJobWorkerOptions WorkerOptions { get; }
@ -19,7 +19,7 @@ namespace Volo.Abp.BackgroundJobs
public BackgroundJobWorker(
AbpTimer timer,
IOptions<BackgroundJobOptions> jobOptions,
IOptions<AbpBackgroundJobOptions> jobOptions,
IOptions<BackgroundJobWorkerOptions> workerOptions,
IServiceScopeFactory serviceScopeFactory)
: base(timer)

@ -30,7 +30,7 @@ namespace Volo.Abp.Emailing
options.FileSets.AddEmbedded<AbpEmailingModule>();
});
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.AddJob<BackgroundEmailSendingJob>();
});

@ -13,7 +13,7 @@ namespace Volo.Abp.BackgroundJobs
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

@ -14,7 +14,7 @@ namespace Acme.BookStore.DbMigrator
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
}
}
}

@ -19,7 +19,7 @@ namespace Acme.BookStore
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

@ -14,7 +14,7 @@ namespace Acme.BookStore.DbMigrator
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
}
}
}

@ -19,7 +19,7 @@ namespace Acme.BookStore
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

@ -19,7 +19,7 @@ namespace Acme.BookStore
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

@ -19,7 +19,7 @@ namespace DashboardDemo
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

@ -14,7 +14,7 @@ namespace MyCompanyName.MyProjectName.DbMigrator
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
}
}
}

@ -89,7 +89,7 @@ namespace MyCompanyName.MyProjectName
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
});
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<BackgroundJobOptions>(options =>
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});

Loading…
Cancel
Save