public string Voice2TextFailed(bool requeueAsTheLast, [FromBody] Voice2Text task) { using (HlidacStatu.Q.Simple.Queue <Voice2Text> sq = new Q.Simple.Queue <Voice2Text>(Voice2Text.QName + "_failed", Devmasters.Config.GetWebConfigValue("RabbitMqConnectionString"))) { sq.Send(task); } return("OK"); }
public string Voice2TextDone([FromBody] Voice2Text task) { using (HlidacStatu.Q.Simple.Queue <Voice2Text> sq = new Q.Simple.Queue <Voice2Text>(Voice2Text.QName + "_done", Devmasters.Config.GetWebConfigValue("RabbitMqConnectionString"))) { task.internaltaskid = 0; sq.Send(task); } return($"OK"); }
public string Voice2TextNewTask(string datasetId, string itemId, int priority = 0) { using (HlidacStatu.Q.Simple.Queue <Voice2Text> sq = new Q.Simple.Queue <Voice2Text>( Voice2Text.QName_priority(priority), Devmasters.Config.GetWebConfigValue("RabbitMqConnectionString")) ) { sq.Send(new Voice2Text() { dataset = datasetId, itemid = itemId }); return($"OK"); } }
public string Voice2TextFailed(bool requeueAsTheLast, [FromBody] Voice2Text task) { using (HlidacStatu.Q.Simple.Queue <TaskResult <Voice2Text> > sq = new Q.Simple.Queue <TaskResult <Voice2Text> >(Voice2Text.QName_failed, Devmasters.Config.GetWebConfigValue("RabbitMqConnectionString"))) { TaskResult <Voice2Text> result = new TaskResult <Voice2Text>() { Payload = task, Created = DateTime.Now, Result = "failed", User = this.ApiAuth?.ApiCall?.User, FromIP = this.HostIpAddress }; sq.Send(result); } return("OK"); }
public Voice2Text Voice2TextGetTask() { Voice2Text task = null; foreach (var p in Voice2Text.Priorities) { using (HlidacStatu.Q.Simple.Queue <Voice2Text> sq = new Q.Simple.Queue <Voice2Text>(Voice2Text.QName_priority(p), Devmasters.Config.GetWebConfigValue("RabbitMqConnectionString"))) { task = sq.GetAndAck(); if (task != null) { return(task); } } } if (task == null) { throw new HttpResponseException(new ErrorMessage(System.Net.HttpStatusCode.NoContent, $"No taks available")); } return(task); }