$builder = new ServicesBuilder(); $queueRestProxy->createMessage("myqueue", "Hello World! 1");
$queue_metadata = $queueRestProxy->getQueueMetadata("myqueue"); $approx_msg_count = $queue_metadata->getApproximateMessageCount();
<?php require_once "WindowsAzure/WindowsAzure.php"; require_once 'PHPUnit\autoload.php'; use WindowsAzure\Common\ServicesBuilder; use WindowsAzure\Common\ServiceException; use WindowsAzure\Queue\Models\CreateMessageOptions; // Create Connection String $connectionString = "DefaultEndpointsProtocol=http;AccountName=[yourAccount];AccountKey=[yourKey]"; // Create queue REST proxy. $queueRestProxy = ServicesBuilder::getInstance()->createQueueService($connectionString); try { // Create queue message. $builder = new ServicesBuilder(); $queueRestProxy->createMessage("myqueue", "Hello World! 1"); echo "Queue message has been added."; } catch(ServiceException $e){ // Handle exception based on error codes and messages. // Error codes and messages are here: // http://msdn.microsoft.com/en-us/library/windowsazure/dd179446.aspx $code = $e->getCode(); $error_message = $e->getMessage(); echo $code.": ".$error_message."<br />"; } ?>
<?php require_once "WindowsAzure/WindowsAzure.php"; require_once 'PHPUnit\autoload.php'; use WindowsAzure\Common\ServicesBuilder; use WindowsAzure\Common\ServiceException; // Create Connection String $connectionString = "DefaultEndpointsProtocol=http;AccountName=[yourAccount];AccountKey=[yourKey]"; // Create queue REST proxy. $queueRestProxy = ServicesBuilder::getInstance()->createQueueService($connectionString); try { // Get queue metadata. $queue_metadata = $queueRestProxy->getQueueMetadata("myqueue"); $approx_msg_count = $queue_metadata->getApproximateMessageCount(); } catch(ServiceException $e){ // Handle exception based on error codes and messages. // Error codes and messages are here: // http://msdn.microsoft.com/en-us/library/windowsazure/dd179446.aspx $code = $e->getCode(); $error_message = $e->getMessage(); echo $code.": ".$error_message."<br />"; } echo $approx_msg_count; ?>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท