2016-09-13 12 views
0

私は2つのサーバー、ServerAとServerBを持っています。彼らは同じハングファイアデータベースを共有します。 私はJobAとJobBという2つのジョブを持っています。サーバーAでHangfire - 指定されたキュー名を持つ定期ジョブ

、私が使用:

ServerBの
RecurringJob.AddOrUpdate(
      "JobA", 
      () => new JobA().Execute(), 
      this._configuration.Schedule, queue: "A"); 

、私が使用:

RecurringJob.AddOrUpdate(
      "JobB", 
      () => new JobB().Execute(), 
      this._configuration.Schedule, queue: "B"); 

問題は、各ジョブが "ジョブ" 表で "エンキュー" であるということです、彼らは決してありません実行される。

"AddOrUpdate"メソッドでキューオーバーライドを削除すると、ジョブが実行されます(キューは設定されていません)。

何か不足していますか?定期的なジョブをキュー構成で設定するには?コードが欠落していた

答えて

1

...

サーバーA:

var options = new BackgroundJobServerOptions 
      { 
       Queues = new[] { "A" } 
      }; 

      this._backgroundJobServer = new BackgroundJobServer(options); 

サーバーB:

var options = new BackgroundJobServerOptions 
      { 
       Queues = new[] { "B" } 
      }; 

      this._backgroundJobServer = new BackgroundJobServer(options); 
+0

私が使用していますがハングファイア1.5.6。私も同様の問題があります。解決策を見つけましたか? –

1

ソリューション - 同様の問題を持つ人に役立つかもしれない:

app.UseHangfireServer(new BackgroundJobServerOptions 
{ 
    // queue name must be in lowercase 
    Queues = new[] { "qname" } //This will setup the server to only process qname queues 
}); 

RecurringJob.AddOrUpdate(
    () => new JobB().Execute(), 
    Cron.Hourly(5), 
    null, 
    "qname"); 
関連する問題