// Retrieve a reference to a queue CloudQueue queue = queueClient.getQueueReference("myqueue"); // Peek at the next message CloudQueueMessage peekedMessage = queue.peekMessage(); out.print("Peeked message:<br />"); out.print("Message Id: " + peekedMessage.getId() + "<br />"); out.print("Date: " + peekedMessage.getInsertionTime() + "<br />"); out.print("Message text: " + peekedMessage.getMessageContentAsString() + "<br />");
<%@ page import="com.microsoft.windowsazure.services.core.storage.*" %> <%@ page import="com.microsoft.windowsazure.services.queue.client.*" %> <html> <head> <title>ThaiCreate.Com Azure Tutorial</title> </head> <body> <% String storageConnectionString = "DefaultEndpointsProtocol=http;" + "AccountName=[yourAccount];" + "AccountKey=[yourKey]"; // Retrieve storage account from connection-string CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); // Create the queue client CloudQueueClient queueClient = storageAccount.createCloudQueueClient(); // Retrieve a reference to a queue CloudQueue queue = queueClient.getQueueReference("myqueue"); // Peek at the next message CloudQueueMessage peekedMessage = queue.peekMessage(); out.print("Peeked message:<br />"); out.print("Message Id: " + peekedMessage.getId() + "<br />"); out.print("Date: " + peekedMessage.getInsertionTime() + "<br />"); out.print("Message text: " + peekedMessage.getMessageContentAsString() + "<br />"); %> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท