public function count($queueName) { $response = $this->sqs->get_queue_size($queueName); if (is_numeric($response)) { return $response; } else { return $this->parseResponse($response); } }
* specific language governing permissions and limitations under the * License. * * Modified by Jeffrey S. Haemer <*****@*****.**> */ error_reporting(E_ALL); require_once 'AWSSDKforPHP/sdk.class.php'; require_once 'include/book.inc.php'; // Create the SQS access object $sqs = new AmazonSQS(); // Form list of queues $queues = array(URL_QUEUE, PARSE_QUEUE, IMAGE_QUEUE, RENDER_QUEUE); // Titles $underlines = ''; foreach ($queues as $queueName) { printf("%-12s ", $queueName); $underlines .= str_repeat('-', strlen($queueName)) . str_repeat(' ', 12 - strlen($queueName)) . " "; } print "\n"; print $underlines . "\n"; // Report on each queue foreach ($queues as $queueName) { $res = $sqs->create_queue($queueName); if ($res->isOK()) { $queueURL = urlFromQueueObject($res); $size = $sqs->get_queue_size($queueURL); printf("%-12s ", number_format($size)); } } print "\n"; exit(0);
/** * Method: get_queue_size() * Identical to <AmazonSQS::get_queue_size()>, except that you don't need to pass in a queue URL. * * Access: * public * * Returns: * _integer_ The Approximate number of messages in the queue. * * See Also: * Example Usage - http://tarzan-aws.com/docs/examples/sqsqueue/get_queue_size.phps */ public function get_queue_size() { if ($this->queue_url) { return parent::get_queue_size($this->queue_url); } throw new SQSQueue_Exception(SQSQUEUE_DEFAULT_ERROR); }
* or in the "license.txt" file accompanying this file. This file is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS * OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the * License. */ error_reporting(E_ALL); require_once 'sdk.class.php'; require_once 'include/book.inc.php'; // Create the SQS access object $sqs = new AmazonSQS(); // Form list of queues $queues = array(URL_QUEUE, PARSE_QUEUE, IMAGE_QUEUE, RENDER_QUEUE); // Titles $underlines = ''; foreach ($queues as $queueName) { printf("%-12s ", $queueName); $underlines .= str_repeat('-', strlen($queueName)) . str_repeat(' ', 12 - strlen($queueName)) . " "; } print "\n"; print $underlines . "\n"; // Report on each queue foreach ($queues as $queueName) { $res = $sqs->create_queue($queueName); if ($res->isOK()) { $size = $sqs->get_queue_size($res->body->CreateQueueResult->QueueUrl); printf("%-12s ", number_format($size)); } } print "\n"; exit(0);