Esempio n. 1
0
<?php

include_once "httpsqs_client.php";
$httpsqs = new httpsqs();
$message = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaa";
$number = 20000;
/* test queue put */
echo "Test Queue PUT, please waitting ...\n";
$start_time = microtime(true);
for ($i = 1; $i <= $number; $i++) {
    $httpsqs->pput("127.0.0.1", 1218, "utf-8", "command_line_test", $i . $message);
}
$run_time = microtime(true) - $start_time;
echo "PUT " . $number . " messages. Run Time for Queue PUT: {$run_time} sec, " . $number / $run_time . " requests/sec\n";
ob_flush();
/* test queue get */
echo "Test Queue GET, please waitting ...\n";
$start_time = microtime(true);
for ($i = 1; $i <= $number; $i++) {
    $result = $httpsqs->pget("127.0.0.1", 1218, "utf-8", "command_line_test");
    //echo($result."\n");
}
$run_time = microtime(true) - $start_time;
echo "GET " . $number . " messages. Run Time for Queue GET: {$run_time} sec, " . $number / $run_time . " requests/sec\n";
Esempio n. 2
0
echo "###2.get result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->put("127.0.0.1", 1218, "utf-8", "your_queue_name1", urlencode("text_message2"));
echo "###3.put result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->gets("127.0.0.1", 1218, "utf-8", "your_queue_name1");
echo "###4.gets result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->pput("127.0.0.1", 1218, "gb2312", "your_queue_name2", urlencode("text_message3"));
echo "###5.pput result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->pget("127.0.0.1", 1218, "gb2312", "your_queue_name2");
echo "###6.pget result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->status("127.0.0.1", 1218, "utf-8", "your_queue_name1");
echo "###7.status result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->status_json("127.0.0.1", 1218, "utf-8", "your_queue_name1");
echo "###8.status_json result:\r\n";
var_dump($result);
echo "\r\n\r\n";
$result = $httpsqs->view("127.0.0.1", 1218, "utf-8", "your_queue_name1", 1);
echo "###9.view result:\r\n";
var_dump($result);
echo "\r\n\r\n";