I am trying to use Hangfire as a Background Job manager with mysql:8.0 as persistence storage. I Use the nuget package "Hangfire.MySqlStorage" Version="2.0.3" to integrate with MySQL. I have the following configuration the the BlazorModule
private static void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddHangfire(config =>
{
config.UseStorage(
new MySqlStorage(
configuration.GetConnectionString("Default") ?? throw new InvalidOperationException("The [ConnectionString:Hangfire] is not configured."),
new MySqlStorageOptions()
)
);
});
context.Services.AddHangfireServer(o =>
{
//o.Queues = new[] { "default", "emails" }; // optional
o.ServerName = "vfsdbuploader-hf";
});
When I run the Process the tables are successfully created but the Process is terminated with the following Error
[13:18:26 FTL] Host terminated unexpectedly!
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.Identity.AbpIdentityProDomainModule, Volo.Abp.Identity.Pro.Domain, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null: Current storage doesn't support specifying queues directly for a specific job. Please use the QueueAttribute instead.. See the inner exception for details.
---> System.NotSupportedException: Current storage doesn't support specifying queues directly for a specific job. Please use the QueueAttribute instead.
at Hangfire.RecurringJobManager.AddOrUpdate(String recurringJobId, Job job, String cronExpression, RecurringJobOptions options) in C:\projects\hangfire-525\src\Hangfire.Core\RecurringJobManager.cs:line 108
at Hangfire.RecurringJob.AddOrUpdate(String recurringJobId, String queue, Expression`1 methodCall, String cronExpression, RecurringJobOptions options) in C:\projects\hangfire-525\src\Hangfire.Core\RecurringJob.cs:line 568
at Volo.Abp.BackgroundWorkers.Hangfire.HangfireBackgroundWorkerManager.AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken)
at Volo.Abp.Identity.AbpIdentityProDomainModule.OnApplicationInitializationAsync(ApplicationInitializationContext context)
at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.InitializeAsync(ApplicationInitializationContext context, IAbpModule module)
at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context)
--- End of inner exception stack trace ---
at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context)
at Volo.Abp.AbpApplicationBase.InitializeModulesAsync()
at Volo.Abp.AbpApplicationWithExternalServiceProvider.InitializeAsync(IServiceProvider serviceProvider)
at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplicationAsync(IApplicationBuilder app)
at VfsDbUploader.Blazor.Program.Main(String[] args) in C:\Users\gpanagakis\Desktop\wc\vfs-db-uploader\src\VfsDbUploader.Blazor\Program.cs:line 66
I have no application specific Job or workers defined the problem is caused by internal ABP worker that are being initialized. When I run the same App using Redis as a Hangfire backend everything is initialized correctly and the following workers are started
[19:45:40 DBG] Started background worker: Volo.Abp.BackgroundJobs.BackgroundJobWorker
[19:45:40 DBG] Started background worker: Volo.Abp.Identity.Session.IdentitySessionCleanupBackgroundWorker
[19:45:40 DBG] Started background worker: Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker
[19:45:41 DBG] Started background worker: Volo.Abp.AuditLogging.ExpiredAuditLogDeleterWorker
[19:45:41 DBG] Started background worker: Volo.Abp.AuditLogging.ExcelFileDownload.ExcelFileCleanupWorker
I tried to use the suggestion "Please use the QueueAttribute " but the problem arises from ABP internal workers that are not under my control What is your suggestion to resolve the issue?
Thank you in advance