PushToQueue() public method

Pushes to queue.
public PushToQueue ( string queue, string body, string>.List headerList ) : string
queue string The queue.
body string The body.
headerList string>.List The header list.
return string
Exemplo n.º 1
0
 public string DescribeActor(string queuename)
 {
     Trace.WriteLineIf(debug, DateTime.Now + string.Format(" Building describe message for queue: {0}", queuename));
     string env = ConfigurationManager.AppSettings["environment"].ToString();
     string correlationid = "";
     string describeMessage = "A simple DESCRIBE request";
     List<KeyValuePair<string, string>> headerList = new List<KeyValuePair<string, string>>();
     headerList.Add(new KeyValuePair<string, string>("VERB", "DESCRIBE"));
     headerList.Add(new KeyValuePair<string, string>("RETURNQUEUE", ConfigurationManager.AppSettings[env + "." + "AtulAdminQueue"].ToString()));
     AtulBusinessLogic adb = new AtulBusinessLogic();
     correlationid = adb.PushToQueue(queuename, describeMessage, headerList);
     return correlationid;
 }
Exemplo n.º 2
0
        public string PushToQueue(string queue, string body, string headers)
        {
            List<KeyValuePair<string, string>> headerList = new List<KeyValuePair<string, string>>();
            try
            {
                string[] parts = headers.Split(new char[] { ',' });
                foreach (string part in parts)
                {
                    if (part.Trim() != string.Empty && part != null)
                    {
                        string[] x = part.Split(new char[] { ':' });
                        if (x.Length > 1)
                        {
                            headerList.Add(new KeyValuePair<string, string>(x[0], x[1]));
                        }
                    }
                }
            }

            catch (Exception e)
            {
                throw new Exception("Headers may be in invalid format.");
            }

            string d = string.Empty;
            AtulBusinessLogic adb = new AtulBusinessLogic();
            d = adb.PushToQueue(queue.Trim(), body.Trim(), headerList);
            return d;
        }