diff --git a/Core/Remote/PiscalLeafInput.cs b/Core/Remote/PiscalLeafInput.cs
index 74b3fc3..6927034 100644
--- a/Core/Remote/PiscalLeafInput.cs
+++ b/Core/Remote/PiscalLeafInput.cs
@@ -13,6 +13,7 @@ namespace LeafWeb.Core.Remote
public string DirectoryName { get; set; }
public bool SuppressStorageCopy { get; set; }
public PiscalLeafInputFile[] InputFiles { get; set; }
+ public string NotifyCompleteUrl { get; set; }
static PiscalLeafInput()
{
diff --git a/Core/Remote/PiscalSshClient.cs b/Core/Remote/PiscalSshClient.cs
index 0997f0f..a07ef48 100644
--- a/Core/Remote/PiscalSshClient.cs
+++ b/Core/Remote/PiscalSshClient.cs
@@ -73,6 +73,9 @@ namespace LeafWeb.Core.Remote
if (leafInput.SuppressStorageCopy)
commandText += " -t";
+ if (!string.IsNullOrEmpty(leafInput.NotifyCompleteUrl))
+ commandText += $" -u {leafInput.NotifyCompleteUrl}";
+
var command = ssh.CreateCommand(commandText);
command.Execute();
ssh.Disconnect();
diff --git a/Web/Controllers/LeafInputController.cs b/Web/Controllers/LeafInputController.cs
index f1761e0..ecf538d 100644
--- a/Web/Controllers/LeafInputController.cs
+++ b/Web/Controllers/LeafInputController.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections;
-using System.Collections.Generic;
using System.IO;
-using System.IO.Compression;
using System.Linq;
-using System.Runtime.InteropServices.ComTypes;
using System.Web;
using System.Web.Mvc;
using LeafWeb.Core.Entities;
@@ -104,15 +100,20 @@ namespace LeafWeb.Web.Controllers
return View("Index", viewModel);
}
- public FileContentResult DownloadResults(int d)
+ public FileContentResult DownloadResults(int id)
{
- var leafInput = DataService.GetLeafInput(d);
+ var leafInput = DataService.GetLeafInput(id);
var zip = leafInput.GetOutputFileZip();
return new FileContentResult(zip, "application/zip") {FileDownloadName = leafInput.Identifier + ".zip"};
}
+ public void NotifyComplete()
+ {
+ HangfireStartup.TriggerPiscalProcessQueue();
+ }
+
private FileInfo[] GetBackloadDirectoryFiles(string directoryName)
{
var path = Path.Combine(Server.MapPath("~/Files/"), directoryName + "\\");
diff --git a/Web/Services/PiscalQueue/PiscalService.cs b/Web/Services/PiscalQueue/PiscalService.cs
index 7fed022..6656efb 100644
--- a/Web/Services/PiscalQueue/PiscalService.cs
+++ b/Web/Services/PiscalQueue/PiscalService.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Configuration;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Remote;
@@ -11,10 +12,14 @@ namespace LeafWeb.Web.Services.PiscalQueue
public class PiscalService
{
private readonly IPiscalClient _piscalClient;
+ private readonly string _notifyCompleteUrl;
public PiscalService(IPiscalClient piscalClient)
{
_piscalClient = piscalClient;
+ _notifyCompleteUrl =
+ ConfigurationManager.AppSettings["LeafWebUrl"] +
+ ConfigurationManager.AppSettings["PiscalNotifyCompleteUrlPath"];
}
public PiscalService() : this(new PiscalSshClient(ConfigurationManager.ConnectionStrings["PiscalServer"].ConnectionString))
@@ -24,6 +29,10 @@ namespace LeafWeb.Web.Services.PiscalQueue
public void Run(LeafInput leafInput)
{
var inputFile = new PiscalLeafInput(leafInput);
+
+ if (!string.IsNullOrEmpty(_notifyCompleteUrl))
+ inputFile.NotifyCompleteUrl = _notifyCompleteUrl;
+
// TODO: remove this, just for testing
if (string.Equals(leafInput.Email, "james.kolpack@gmail.com", StringComparison.InvariantCultureIgnoreCase))
inputFile.SuppressStorageCopy = true;
diff --git a/Web/Web.config b/Web/Web.config
index f15ea80..f5ce4a6 100644
--- a/Web/Web.config
+++ b/Web/Web.config
@@ -30,6 +30,8 @@
+
+