Add Hangfire

Adjust namespace
This commit is contained in:
2016-11-17 13:36:13 -05:00
parent 88a21593da
commit eeacfebec9
34 changed files with 1007 additions and 38 deletions
@@ -0,0 +1,35 @@
using System;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Remote;
using LeafWeb.WebCms.App_Start;
namespace LeafWeb.WebCms.Services.PiscalQueue
{
public abstract class PiscalQueueWorker : PiscalQueueBase
{
public void DoWork(int leafInputId)
{
LeafInput leafInput = null;
try
{
leafInput = DataService.GetLeafInput(leafInputId);
DoWorkInternal(leafInput);
}
catch (PiscalClientException ex)
{
PiscalExceptionHandler(ex, leafInput);
// signal to process next item
HangfireStartup.TriggerPiscalProcessQueue();
}
catch (Exception ex)
{
var errorMessage = FormatException(ex);
Logger.Error(errorMessage);
throw; // this will retry via HangFire
}
}
protected abstract void DoWorkInternal(LeafInput leafInputId);
}
}