我在配置和使用多个队列时遇到了麻烦。
以下是我的创业课内容:
var options = new DashboardOptions
{
AppPath = VirtualPathUtility.ToAbsolute("~")
};
app.UseHangfireDashboard("/jobs", options);
var queues = new BackgroundJobServerOptions
{
Queues = new[] { "high", "normal" }
};
app.UseHangfireServer(queues);
服务器正确启动,从仪表板我可以看到队列。
但是当我尝试将进程排入队列时,hangfire 总是将作业设置到默认队列中。这是对该方法的调用:
BackgroundJob
.Enqueue<IFileConverterService>(
x => x.CreateSlides(docId, folderpath, priority));
这是方法实现:
public class FileConverterService : IFileConverterService
{
[Queue("high")]
public void CreateSlides(Guid documentId, string folderPath, int priority)
{
//my stuff
}
}
我错过了什么?