private string queueFacebookMessage(string fbUserID, string fbApplicationID, string oAuthToken, DateTime fbIssuedAt,DateTime fbExpires, string fbProcessingQueue, string azureAccount, string azureSharedKey) { string retVal = string.Empty; UpdateUserApplicationOAuth(fbUserID, fbApplicationID, oAuthToken, fbIssuedAt, fbExpires); //if (DateTime.UtcNow < fbExpires) { retVal=string.Format("<UserID>{0}</UserID>", fbUserID); string fbMessage = string.Format("<root><fbGetUserInfo fbUserID=\"{0}\" fbOAuthToken=\"{1}\" authExpires=\"{2}\" /></root>", fbUserID, oAuthToken, DateTime.UtcNow.AddMinutes(60)); Finsel.AzureCommands.AzureQueueStorage aqs = new Finsel.AzureCommands.AzureQueueStorage(azureAccount, string.Format("http://{0}.queue.core.windows.net", azureAccount), azureSharedKey, "SharedKey"); azureResults ar = aqs.Messages(cmdType.post, fbProcessingQueue, fbMessage, "", ""); } return retVal; }
private void btnLoadDemo_Click(object sender, EventArgs e) { string newID = Guid.NewGuid().ToString(); string queueMessage = string.Format("<message><updateID>{0}</updateID><account>{1}</account><key>{2}</key><table>{3}</table><source>http://finseldemos.blob.core.windows.net/public/CalendarDemo.xml</source></message>", newID,txtAccount.Text, txtSharedKey.Text, cbTables.Text ); AzureTableStorage ats = new AzureTableStorage(txtAccount.Text, "", txtSharedKey.Text, "SharedKey"); azureResults ar = ats.Tables(cmdType.post, bulkTag); ar = ats.Entities(cmdType.post, bulkTag, newID, "Summary", string.Format(queueInitialCreationEntity, newID), null); AzureQueueStorage aqs = new AzureQueueStorage(txtAccount.Text, "", txtSharedKey.Text, "SharedKey"); ar = aqs.Queues(cmdType.put, bulkTag, null, new Hashtable()); ar = aqs.Messages(cmdType.post, bulkTag, queueMessage, string.Empty, string.Empty); }
private void txtProcessDemo_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; StringBuilder sbResultsForStorage = new StringBuilder(); AzureQueueStorage aqs = new AzureQueueStorage(txtAccount.Text, string.Format("http://{0}.queue.core.windows.net", txtAccount.Text), txtSharedKey.Text, "SharedKey"); azureResults ar = aqs.Messages(cmdType.get, bulkTag, "", "visibilitytimeout=7200", ""); string MessageID = ""; string PopReceipt = ""; string Message = ""; if (ar.Body != null) { System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); if (ar.Succeeded) { xdoc.LoadXml(ar.Body); System.Xml.XmlNodeList nodes = xdoc.SelectNodes("//QueueMessage"); StringBuilder sbMultipart = new StringBuilder(); if (nodes.Count == 0) txtMessage.Text = "No message to process"; else foreach (System.Xml.XmlNode node in nodes) { MessageID = node.SelectSingleNode("MessageId").InnerText; PopReceipt = node.SelectSingleNode("PopReceipt").InnerText; Message = node.SelectSingleNode("MessageText").InnerText; System.Xml.XmlDocument msgDoc = new XmlDocument(); msgDoc.LoadXml(Message); string newAccount = msgDoc.SelectSingleNode("//account[1]").InnerXml; string newKey = msgDoc.SelectSingleNode("//key[1]").InnerXml; string newSource = msgDoc.SelectSingleNode("//source[1]").InnerXml; string updateID = msgDoc.SelectSingleNode("//updateID[1]").InnerXml; string newTable = msgDoc.SelectSingleNode("//table[1]").InnerXml; AzureTableStorage ats = new AzureTableStorage(txtAccount.Text, "", txtSharedKey.Text, "SharedKey"); AzureTableStorage ats1 = new AzureTableStorage(txtAccount.Text, "", txtSharedKey.Text, "SharedKey"); azureHelper ah = new azureHelper(txtAccount.Text, txtEndpoint.Text, txtSharedKey.Text, "SharedKey"); string mrgMessage = string.Format(queueUpdateCreationEntity, updateID, 0, 0); ats.Entities(cmdType.merge, bulkTag, updateID, "000000000000000", mrgMessage, ""); ats.Entities(cmdType.merge, bulkTag, updateID, "000000000000000", string.Format("<m:properties>\n\t<d:PartitionKey>{0}</d:PartitionKey>\n\t<d:RowKey>000000000000000</d:RowKey><d:StartedProcessing>{1}</d:StartedProcessing></m:properties>", updateID, DateTime.UtcNow.ToLongTimeString()), ""); AzureBlobStorage abs = new AzureBlobStorage(newAccount, string.Format("http://{0}.blob.core.windows.net", newAccount), newKey, "SharedKey"); AzureTableStorage atsNew = new AzureTableStorage(newAccount, string.Format("http://{0}.blob.core.windows.net", newAccount), newKey, "SharedKey"); ar = atsNew.Tables(cmdType.post, newTable); if (ar.Succeeded || ar.StatusCode == System.Net.HttpStatusCode.Conflict) { ar = new azureResults(); string newContainer = newSource.Replace(string.Format("http://{0}.blob.core.windows.net/", newAccount), ""); newContainer = newContainer.Substring(0, newContainer.IndexOf("/")); string newBlob = newSource.Replace(string.Format("http://{0}.blob.core.windows.net/", newAccount), "").Replace(newContainer, ""); byte[] blob = abs.GetBlob(newContainer, newBlob, "", ref ar); string x = new System.Text.UTF8Encoding().GetString(blob); x = x.Substring(x.IndexOf("<")); msgDoc.LoadXml(x); int errorCt = 0; int processedCt = 0; //Instantiate an XmlNamespaceManager object. System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(xdoc.NameTable); //Add the namespaces used in books.xml to the XmlNamespaceManager. xmlnsManager.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices"); xmlnsManager.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"); XmlNodeList pnodes = msgDoc.SelectNodes("//m:properties", xmlnsManager); int iCounter = 101; int iResponse = 1; foreach (XmlNode pnode in pnodes) { if (iCounter > 100) { if (sbMultipart.Length > 0) { sbMultipart.Append("</entry>"); ProcessMultiPartForStatus(ats.auth, ah.entityGroupTransaction(cmdType.post, newTable, sbMultipart.ToString()), bulkTag, updateID, iResponse.ToString("D15"), ref processedCt, ref errorCt, "201 Created"); ar = ats1.Entities(cmdType.post, bulkTag, updateID, iResponse.ToString("D15"), sbResultsForStorage.ToString(), ""); mrgMessage = string.Format(queueUpdateCreationEntity, updateID, processedCt, errorCt); ats.Entities(cmdType.merge, bulkTag, updateID, "000000000000000", mrgMessage, "", "*"); iResponse++; } sbMultipart = new StringBuilder(); sbMultipart.AppendFormat(@"<?xml version=""1.0"" encoding=""utf-8"" ?><entry xml:base=""http://finseldemos.table.core.windows.net/"" xmlns:d=""http://schemas.microsoft.com/ado/2007/08/dataservices"" xmlns:m=""http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"" xmlns=""http://www.w3.org/2005/Atom"">"); iCounter = 0; } sbMultipart.Append(pnode.OuterXml); iCounter++; } sbMultipart.Append("</entry>"); ProcessMultiPartForStatus(ats.auth, ah.entityGroupTransaction(cmdType.post, newTable, sbMultipart.ToString()), bulkTag, updateID, iResponse.ToString("D15"), ref processedCt, ref errorCt, "201 Created"); mrgMessage = string.Format(queueUpdateCreationEntity, updateID, processedCt, errorCt).Replace("Processing", "Completed"); ats.Entities(cmdType.merge, bulkTag, updateID, "000000000000000", mrgMessage, "", "*"); } else { mrgMessage = string.Format(queueUpdateCreationEntity, updateID, 0, 0).Replace("Processing", "Failed to create table!"); ats.Entities(cmdType.merge, bulkTag, updateID, "000000000000000", mrgMessage, ""); } aqs.Messages(cmdType.delete, bulkTag, "", string.Format("popreceipt={0}", PopReceipt), MessageID); ats.Entities(cmdType.merge, bulkTag, updateID, "000000000000000", string.Format("<m:properties>\n\t<d:PartitionKey>{0}</d:PartitionKey>\n\t<d:RowKey>000000000000000</d:RowKey><d:CompletedProcessing>{1}</d:CompletedProcessing></m:properties>", updateID, DateTime.UtcNow.ToLongTimeString()), ""); } } else txtMessage.Text = "No message to process"; ProcessResults(ar); this.Cursor = Cursors.Default; } }
private void btnDeleteMessage_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; AzureQueueStorage aqs = new AzureQueueStorage(txtAccount.Text, string.Format("http://{0}.queue.core.windows.net", txtAccount.Text), txtSharedKey.Text, "SharedKey"); string parameters = string.Empty; if (txtPopReceipt.Text != string.Empty) parameters = string.Format("popreceipt={0}", txtPopReceipt.Text); azureResults ar = aqs.Messages(cmdType.delete, cbQueues.Text, "", parameters, txtMessageID.Text); ProcessResults(ar); this.Cursor = Cursors.Default; }
private void btnGetMessage_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; AzureQueueStorage aqs = new AzureQueueStorage(txtAccount.Text, string.Format("http://{0}.queue.core.windows.net", txtAccount.Text), txtSharedKey.Text, "SharedKey"); azureResults ar = aqs.Messages(cmdType.get, cbQueues.Text, "", txtQParameters.Text, ""); txtMessageID.Text = ""; txtPopReceipt.Text = ""; txtMessage.Text = ""; if (ar.Body != null) { System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(ar.Body); System.Xml.XmlNodeList nodes = xdoc.SelectNodes("//QueueMessage"); if (nodes.Count == 0) txtMessage.Text = "No message to process"; else foreach (System.Xml.XmlNode node in nodes) { txtMessageID.Text = node.SelectSingleNode("MessageId").InnerText; if (node.SelectNodes("//PopReceipt").Count > 0) txtPopReceipt.Text = node.SelectSingleNode("PopReceipt").InnerText; if (node.SelectNodes("//MessageText").Count > 0) txtMessage.Text = node.SelectSingleNode("MessageText").InnerText; } } else txtMessage.Text = "No message to process"; ProcessResults(ar); this.Cursor = Cursors.Default; }
private void btnCreateMessage_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; AzureQueueStorage aqs = new AzureQueueStorage(txtAccount.Text, string.Format("http://{0}.queue.core.windows.net", txtAccount.Text), txtSharedKey.Text, "SharedKey"); azureResults ar = aqs.Messages(cmdType.post, cbQueues.Text, txtMessage.Text, "", ""); ProcessResults(ar); this.Cursor = Cursors.Default; }
public void ProcessMessage(string fbQueue) { AzureQueueStorage aqs = new AzureQueueStorage(azureAppName, string.Format("http://{0}.queue.core.windows.net", azureAppName), azureSharedKey, "SharedKey"); azureResults ar = aqs.Messages(cmdType.get, fbQueue, "", "", ""); string messageID = string.Empty; string popReceipt = string.Empty; string message = string.Empty; while (ar.Succeeded) { if (ar.Body != null) { System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(ar.Body); System.Xml.XmlNodeList nodes = xdoc.SelectNodes("//QueueMessage"); if (nodes.Count != 0) { foreach (System.Xml.XmlNode node in nodes) { messageID = node.SelectSingleNode("MessageId").InnerText; if (node.SelectNodes("//PopReceipt").Count > 0) popReceipt = node.SelectSingleNode("PopReceipt").InnerText; if (node.SelectNodes("//MessageText").Count > 0) message = node.SelectSingleNode("MessageText").InnerText; xdoc.LoadXml(message); nodes = xdoc.SelectNodes("//fbGetUserInfo"); foreach (XmlNode n in nodes) { string fbUserID = n.Attributes["fbUserID"].Value; Trace.WriteLine(string.Format("Processing fb information for user {0}", fbUserID), "Information"); string fbOAuthToken = n.Attributes["fbOAuthToken"].Value; string fbauthExpires = n.Attributes["authExpires"].Value; while (fbUserID.StartsWith("fb")) fbUserID = fbUserID.Substring(2); if (Convert.ToDateTime(fbauthExpires) > DateTime.UtcNow) { string graphURL = string.Format("https://graph.facebook.com/{0}/friends/?access_token={1}", fbUserID, fbOAuthToken); try { HttpClient ht = new HttpClient(); string graphInfo = ht.Execute(graphURL, "GET"); graphInfo = "{\"?xml\": {\"@version\": \"1.0\",\"@standalone\": \"no\"},\"root\": {" + graphInfo.Substring(1);// +"}}"; XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(graphInfo); LoadFriendList("fb" + fbUserID, doc.InnerXml); } catch(Exception ex) { Console.WriteLine(ex.ToString()); } try { //System.Net.HttpWebRequest req = null; //System.Net.HttpWebResponse resp = null; HttpClient ht = new HttpClient(); graphURL = string.Format("https://graph.facebook.com/{0}/?access_token={1}", fbUserID, fbOAuthToken); // ht = new HttpClient(); //req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(graphURL); //req.Method = "GET"; string graphInfo = ht.Execute(graphURL, "GET"); graphInfo = "{\"?xml\": {\"@version\": \"1.0\",\"@standalone\": \"no\"},\"root\": {" + graphInfo.Substring(1);// +"}}"; XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(graphInfo); UpdateUserDataSocialInformation("fb" + fbUserID, doc.InnerXml); } catch(Exception ex) { Console.WriteLine(ex.ToString()); } } ar = aqs.Messages(cmdType.delete, fbQueue, "", string.Format("popreceipt={0}", popReceipt), messageID); } ar = aqs.Messages(cmdType.get, fbQueue, "", "", ""); } } else break; } } }
public void ProcessRequest(HttpContext context) { string accountName = string.Empty; string sharedKey = string.Empty; string queueTypeOfCall = string.Empty; string message = string.Empty; string queueName = string.Empty; string messageID = string.Empty; string popReceipt = string.Empty; string qParameters = string.Empty; if (context.Request.Params.AllKeys.Contains("accountname")) { accountName = context.Request.Params["accountname"].ToString(); } if (context.Request.Params.AllKeys.Contains("sharedkey")) { sharedKey = context.Request.Params["sharedkey"].ToString().Replace(" ", "+"); } if (context.Request.Params.AllKeys.Contains("queuetypeofcall")) { queueTypeOfCall = context.Request.Params["queuetypeofcall"].ToString(); } if (context.Request.Params.AllKeys.Contains("queuename")) { queueName = context.Request.Params["queuename"].ToString(); } if (context.Request.Params.AllKeys.Contains("messageid")) { messageID = context.Request.Params["messageid"].ToString(); } if (context.Request.Params.AllKeys.Contains("popreceipt")) { popReceipt = context.Request.Params["popreceipt"].ToString(); } if (context.Request.Params.AllKeys.Contains("message")) { message = context.Request.Params["message"].ToString(); } string retVal = string.Empty; string retValType = string.Empty; retValType = "text/xml"; Hashtable ht = new Hashtable(); foreach (string key in context.Request.Params.AllKeys) { if (key.StartsWith("x-ms-meta-")) if (ht.ContainsKey(key)) ht[key] = string.Format("{0},{1}", ht[key].ToString(), context.Request.Params[key].ToString()); else ht.Add(key, context.Request.Params[key].ToString()); } azureResults ar = new azureResults(); Finsel.AzureCommands.AzureQueueStorage aqs = new Finsel.AzureCommands.AzureQueueStorage(accountName, string.Format("http://{0}.blob.core.windows.net", accountName), sharedKey, "SharedKey"); switch (queueTypeOfCall.ToLower()) { case "addqueuemetadata": ar = aqs.MetaData(cmdType.put, queueName, ht); retVal = processAzureResults(ar); break; case "clearqueue": ar = aqs.Messages(cmdType.delete, queueName, "", "", ""); retVal = processAzureResults(ar); break; case "createmessage": ar = aqs.Messages(cmdType.post, queueName, message, "", ""); retVal = processAzureResults(ar); break; case "createqueue": ht.Add("x-ms-meta-CreatedBy", "Finsel.AzureCommands"); ar = aqs.Queues(cmdType.put, queueName,qParameters , ht); retVal = processAzureResults(ar); break; case "deletemessage": qParameters = string.Format("popreceipt={0}", popReceipt); ar = aqs.Messages(cmdType.delete, queueName,"",qParameters , messageID); retVal = processAzureResults(ar); break; case "deletequeue": ar = aqs.Queues(cmdType.delete, queueName,qParameters, new Hashtable()); retVal = processAzureResults(ar); break; case "deletequeuemetadata": ar = aqs.MetaData(cmdType.get, queueName, null); retVal = processAzureResults(ar); break; case "displayqueuemetadata": ar = aqs.MetaData(cmdType.get, queueName, null); retVal = processAzureResults(ar); break; case "getmessage": ar = aqs.Messages(cmdType.get, queueName, "", qParameters, messageID); retVal = processAzureResults(ar); break; case "getqueuelist": ar = aqs.GetQueueList(qParameters); retVal = processAzureResults(ar); break; case "peekmessage": ar = aqs.Messages(cmdType.get, queueName, "", "peekonly=true", messageID); retVal = processAzureResults(ar); break; default: retVal = @"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' > <head> <title>Finsel Azure Queue Handler Form</title> </head> <body> <form action='aqsHandler.ashx' method='post'> <table border='1'> <tr> <td>Account</td><td><input name='accountname' maxlength='100' /></td> </tr><tr> <td>Shared Key</td><td><input name='sharedkey' maxlength='100' /></td> </tr><tr> <td>Container Name</td><td><input name='queuename' maxlength='100' /></td> </tr><tr> <td>Blob Name</td><td><input name='messageid' maxlength='1240' /></td> </tr><tr> <td>Parameters</td><td><input name='parameters' maxlength='1240' /></td> </tr><tr> <td>Type of call</td><td> <select name='queuetypeofcall'> <option>AddQueueMetadata</option> <option value='CreateQueue'>CreateContainer</option> <option value='DeleteMessage'>DeleteBlob</option> <option value='DeleteQueue'>DeleteContainer</option> <option value='DeleteQueueMetadata'>DeleteContainerMetadata</option> <option value='DisplayQueueMetadata'>DisplayContainerMetadata</option> <option value='GetBlob'>GetMessage</option> <option value='GetQueueList'>GetContainerList</option> </td> </tr><tr> <td colspan='2'><input type='submit' /></td> </tr> </table> </form> </body> </html>"; retValType = "text/html"; break; } context.Response.ContentType = retValType; context.Response.Write(retVal); }
private void click_Queues(object sender, RoutedEventArgs e) { if (e.Source.ToString().StartsWith("System.Windows.Controls.Button")) { this.Cursor = Cursors.Wait; AzureQueueStorage aqs = new AzureQueueStorage(azAccount, string.Format("http://{0}.queue.core.windows.net", azAccount), azSharedKey, "SharedKey"); azureResults ar = new azureResults(); Hashtable ht = new Hashtable(); if (e.Source == btnAddQueueMetaData) { string[] AllData = txtQMetaData.Text.Split("\n".ToCharArray()); foreach (string metadataDetail in AllData) { string[] detail = metadataDetail.Split(":".ToCharArray()); string key = ""; string value = ""; if (detail[0] != string.Empty) { key = detail[0]; if (metadataDetail.Contains(":")) value = detail[1]; ht.Add(key, value); } } ar = aqs.MetaData(cmdType.put, cbQueues.Text, ht); } else if (e.Source == btnClearQueue) { ar = aqs.Messages(cmdType.delete, cbQueues.Text, "", "", ""); } else if (e.Source == btnCreateMessage) { ar = aqs.Messages(cmdType.post, cbQueues.Text, txtMessage.Text, "", ""); } else if (e.Source == btnCreateQueue) { ht.Add("createdBy", "Finsel.AzureCommands"); ar = aqs.Queues(cmdType.put, cbQueues.Text, "", ht); } else if (e.Source == btnDeleteMessage) { string parameters = string.Empty; if (txtPopReceipt.Text != string.Empty) parameters = string.Format("popreceipt={0}", txtPopReceipt.Text); ar = aqs.Messages(cmdType.delete, cbQueues.Text, "", parameters, txtMessageID.Text); } else if (e.Source == btnDeleteQueue) { ar = aqs.Queues(cmdType.delete, cbQueues.Text, "", new Hashtable()); } else if (e.Source == btnDeleteQueueMetaData) { ar = aqs.MetaData(cmdType.put, cbQueues.Text, new Hashtable()); } else if (e.Source == btnDisplayQueueMetadata) { ar = aqs.MetaData(cmdType.get, cbQueues.Text, new Hashtable()); } else if (e.Source == btnGetMessage) { ar = aqs.Messages(cmdType.get, cbQueues.Text, "", txtQParameters.Text, ""); txtMessageID.Text = ""; txtPopReceipt.Text = ""; txtMessage.Text = ""; if (ar.Body != null) { System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(ar.Body); System.Xml.XmlNodeList nodes = xdoc.SelectNodes("//QueueMessage"); if (nodes.Count == 0) txtMessage.Text = "No message to process"; else foreach (System.Xml.XmlNode node in nodes) { txtMessageID.Text = node.SelectSingleNode("MessageId").InnerText; if (node.SelectNodes("//PopReceipt").Count > 0) txtPopReceipt.Text = node.SelectSingleNode("PopReceipt").InnerText; if (node.SelectNodes("//MessageText").Count > 0) txtMessage.Text = node.SelectSingleNode("MessageText").InnerText; } } else txtMessage.Text = "No message to process"; } else if (e.Source == btnGetQueues) { cbQueues.Items.Clear(); cbQueues.Text = string.Empty; ar = aqs.GetQueueList(""); if (ar.Succeeded) { XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(ar.Body); XmlNodeList nodes = xdoc.SelectNodes("//Queue"); foreach (XmlNode node in nodes) { cbQueues.Items.Add(node.SelectSingleNode("Name").InnerText); } if (cbQueues.Items.Count > 0) cbQueues.SelectedIndex = 0; } } ProcessResults(ar); this.Cursor = Cursors.Arrow; } }
public override void Run() { // This is a sample worker implementation. Replace with your logic. Trace.WriteLine("MainWorkerRole entry point called", "Information"); while (true) { Finsel.AzureCommands.AzureQueueStorage aqs = new Finsel.AzureCommands.AzureQueueStorage(azureAccount, string.Format("http://{0}.blob.core.windows.net", azureAccount), azureSharedKey, "SharedKey"); azureResults ar = aqs.Messages(cmdType.get, queueName, string.Empty, string.Empty, string.Empty); if (ar.Succeeded) { System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(ar.Body); System.Xml.XmlNodeList nodes = xdoc.SelectNodes("//QueueMessage"); if (nodes.Count != 0) { foreach (System.Xml.XmlNode node in nodes) { string popReceipt = string.Empty; string messageData = string.Empty; string messageID = node.SelectSingleNode("MessageId").InnerText; if (node.SelectNodes("//PopReceipt").Count > 0) popReceipt = node.SelectSingleNode("PopReceipt").InnerText; if (node.SelectNodes("//MessageText").Count > 0) messageData = node.SelectSingleNode("MessageText").InnerText; if (messageData != string.Empty) { string queryName = string.Empty; NameValueCollection htKeys = new NameValueCollection(); foreach (string messageDetail in messageData.Split("\r\n".ToCharArray())) { if (messageDetail.Contains(":")) htKeys.Add(messageDetail.Substring(0, messageDetail.IndexOf(":")), messageDetail.Substring(messageDetail.IndexOf(":") + 1)); else if (messageDetail != string.Empty) queryName = messageDetail; } quoteSearchLoader qls = new quoteSearchLoader(); if (htKeys.Count == 0 || queryName.ToLower() == "optimize") aqs.Messages(cmdType.delete, queueName, string.Empty, string.Format("popreceipt={0}", popReceipt), messageID); if (queryName.ToLower() == "optimize") { qls.optimizeIndex(htKeys[0]); } else { qls.processRequest(queryName, htKeys); } if (htKeys.Count != 0) aqs.Messages(cmdType.delete, queueName, string.Empty, string.Format("popreceipt={0}", popReceipt), messageID); } else aqs.Messages(cmdType.delete, queueName, string.Empty, string.Format("popreceipt={0}", popReceipt), messageID); } } } fbUserProcessor fbup = new fbUserProcessor(azureAccount, azureSharedKey, string.Format("http://{0}.queue.core.windows.net/", azureAccount), new Utility().ResolveDataConnection("sqlAzureConnection")); fbup.ProcessMessage("fbprocessing"); Thread.Sleep(sleepDuration); if(proc.HasExited) proc = WindowsAzureMemcachedHelpers.StartMemcached("memcacheWorker", 24); } }