Hangfire icon indicating copy to clipboard operation
Hangfire copied to clipboard

Current storage doesn't support specifying queues directly for a specific job. Please use the QueueAttribute instead

Open CommanderAlchemy opened this issue 1 year ago • 2 comments

Hi,

So I made an update to all my packages and to .net8 But issue I'm having now is that a feature that I used to differentiate between debug and production queues is that I used the "queue name"

"default" for all live "debug" well for debugging purposes.

Updating Hangfire did depricate and change some things in AddOrUpdate, but queue is still there.

RecurringJob.AddOrUpdate<IUrlCallerService>(
    job.Description,
    job.Queue,
    methodCall: callerService => callerService
        .GetAsync(job, CancellationToken.None),
    cronExpression: job.CronExpression

This will now throw:

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)

This worked just fine before, the storage I use is Azure Cosmos using CosmosDbStorage pkg.

CommanderAlchemy avatar Nov 17 '23 09:11 CommanderAlchemy

Anyone has a solution or any info regarding this? Been parsing pages after page regarding this but can't find anything here.

CommanderAlchemy avatar Jan 09 '24 07:01 CommanderAlchemy

@CommanderAlchemy do you use this package Hangfire.AzureCosmosDb? Which version do you use of Hangfire? Because I have a similar problem that caused Hangfire to reject the underlying JobStorage. For more information about this, you can view my issue at MAMQSqlExtension which describes the problem in more detail.

With Hangfire 1.8.0 the JobStorage introduced a new method named HasFeature, which checks if the used JobStorage supports several features, including specifying the queue name directly. You can try to go back to a version below 1.8.0 of Hangfire and see if your code works again. If this is the case, then you have the option to stick with the latest 1.7.x version of hangfire or open an issue at the CosmosDbStorage package to upgrade the Hangfire version to 1.8.x and implementing the HasFeature method.

Zeruxky avatar Feb 08 '24 08:02 Zeruxky