* PMS Framework * * @ignore * @category Pms_Message * @package Pms_Message * @author James.Huang <*****@*****.**> * @version $Id$ */ // could be call by other scripts ; avoid path change require_once realpath(dirname(__FILE__) . '/../etc') . '/config.inc'; require_once 'Pms.php'; $action = $argv[1]; // passed parameter $host = PMS_SERVER_HOST; $ports = Pms_Util::getServerPorts(PMS_SERVER_PORT); $xa = new Pms($host, $ports); $xa->beginTransaction(); // start transaction try { if ($action == 'get') { echo "Deal with the messages : \n"; // deal with messages for ($i = 0; $i < 10; $i++) { var_dump($xa->get()); } } if ($action == 'getback') { echo "Deal with the messages : \n"; // deal with messages for ($i = 0; $i < 10; $i++) { var_dump($xa->get());
} // show mq server stats if ($action == 'stats') { echo $client->stats(); exit; } // deal with messages if ($action == 'clear') { $client->clear(); exit; } // do all messages one by one if ($action == 'doall') { foreach ($ports as $port) { // find in all pms mqs $client = new Pms($host, $port); // do get all message while ($client->size()) { var_dump($client->get()); $client->debug(); } } exit; } echo <<<USAGE Usage: php client.php <ACTIONS> Actions: send : Send a message to PMS Server recv : Recv a message from PMS Server