我試圖檢索遲髮型排隊的作業,使用下面的代碼:遲髮型EnqueuedJobs參數
IMonitoringApi monitor = JobStorage.Current.GetMonitoringApi();
var jobData = monitor.EnqueuedJobs(?, 0, 1);
的api說,第一個參數是一個字符串(字符串隊列)。我的問題是,該字符串隊列表示什麼,我該如何獲得?謝謝
我試圖檢索遲髮型排隊的作業,使用下面的代碼:遲髮型EnqueuedJobs參數
IMonitoringApi monitor = JobStorage.Current.GetMonitoringApi();
var jobData = monitor.EnqueuedJobs(?, 0, 1);
的api說,第一個參數是一個字符串(字符串隊列)。我的問題是,該字符串隊列表示什麼,我該如何獲得?謝謝
它是您放置工作的隊列的名稱,因爲您可以在Hangfire中創建多少隊列。
var options = new BackgroundJobServerOptions
{
Queues = new[] { "critical", "default" }
};
app.UseHangfireServer(options);
這裏有兩個隊列,一個是至關重要的,第二個是默認
所以在這裏,你會通過默認,如果您還沒有創建任何隊列爲默認隊列是一個這是默認隊列。
實現的功能
public JobList<EnqueuedJobDto> EnqueuedJobs(string queue, int @from, int perPage)
{
return UseConnection(connection =>
{
var queueApi = GetQueueApi(connection, queue);
var enqueuedJobIds = queueApi.GetEnqueuedJobIds(queue, from, perPage);
return EnqueuedJobs(connection, enqueuedJobIds);
});
}
鏈接,實現這裏https://searchcode.com/codesearch/raw/97584324/
讓我知道,如果你完成它。
謝謝,我結束了使用相同的.. – akshayKhot
酷可以分享你如何結束它,像執行界面,你的界面的片段,如獲取服務器列表等。那將非常感謝 –
那麼,我只是用string'default'。當我最初提出這個問題時,我並不知道Hangfire隊列中有一個名字。我結束了這個:'var jobData = monitor.EnqueuedJobs('default',0,1);' – akshayKhot
「排隊工作」,你的意思是加入排隊狀態? –