コード例 #1
0
 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");
     }
 }
コード例 #2
0
        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);
        }