Estensione metodi di lettura QUEUE
This commit is contained in:
@@ -14,7 +14,7 @@ namespace WebDoorCreator.API.Controllers
|
||||
{
|
||||
Log.Info("Starting QueueController");
|
||||
_configuration = configuration;
|
||||
DService = DataService;
|
||||
QDService = DataService;
|
||||
Log.Info("Avviato QueueController");
|
||||
}
|
||||
|
||||
@@ -22,26 +22,64 @@ namespace WebDoorCreator.API.Controllers
|
||||
|
||||
#region Public Methods
|
||||
|
||||
[HttpGet("GetQueueLenght")]
|
||||
public int GetQueueLenght()
|
||||
/// <summary>
|
||||
/// Lunghezza coda in attesa
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ActPendingLenght")]
|
||||
public async Task<long> ActPendingLenght()
|
||||
{
|
||||
return rndGen.Next(0, 20);
|
||||
long numQueue = await QDService.NumRequestPending();
|
||||
return numQueue;
|
||||
}
|
||||
/// <summary>
|
||||
/// Lunghezza coda in fase di processing
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ActProcessingLenght")]
|
||||
public async Task<long> ActProcessingLenght()
|
||||
{
|
||||
long numQueue = await QDService.NumRequestProcessing();
|
||||
return numQueue;
|
||||
}
|
||||
|
||||
[HttpGet("GetQueueList")]
|
||||
public IEnumerable<string> GetQueueList()
|
||||
/// <summary>
|
||||
/// Elenco richieste in stato pending
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ShowPending")]
|
||||
public async Task<Dictionary<string, string>?> ShowPending()
|
||||
{
|
||||
return Enumerable.Range(1, rndGen.Next(5, 20)).Select(index => $"WDC{rndGen.Next(0, 2000):000000}").ToArray();
|
||||
var actQueue = await QDService.RequestPending();
|
||||
return actQueue;// != null && actQueue.Count > 0 ? actQueue : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco richeiste in stato processing
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ShowProcessing")]
|
||||
public async Task<Dictionary<string, string>> ShowProcessing()
|
||||
{
|
||||
var actQueue = await QDService.RequestProcessing();
|
||||
return actQueue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiede un numero massimo di items dalla coda NB:
|
||||
/// - verranno tolti dalla coda FIFO richieste
|
||||
/// - verranno messi nella coda FIFO processing
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("TakeProcessingItems")]
|
||||
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems)
|
||||
{
|
||||
var actQueue = await QDService.RequestPending();
|
||||
return actQueue;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected Random rndGen = new Random();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
@@ -52,7 +90,7 @@ namespace WebDoorCreator.API.Controllers
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private QueueDataService DService { get; set; } = null!;
|
||||
private QueueDataService QDService { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user