當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Builder::populatePersonsType方法代碼示例

本文整理匯總了PHP中Builder::populatePersonsType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::populatePersonsType方法的具體用法?PHP Builder::populatePersonsType怎麽用?PHP Builder::populatePersonsType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Builder的用法示例。


在下文中一共展示了Builder::populatePersonsType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: AMQPConnection

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Formatter\LineFormatter;
//Parsing the config file
$yml = Yaml::parse(file_get_contents("config.yml"), false, false, true);
$config = json_decode(json_encode($yml));
$connection = new AMQPConnection($config->rabbitmq->host, $config->rabbitmq->port, $config->rabbitmq->user, $config->rabbitmq->pass);
$channel = $connection->channel();
$channel->queue_declare('task_queue', false, true, false, false);
echo "[*] Worker ready! CRTL+C to quit\n";
$callback = function ($message) {
    $demande = json_decode($message->body);
    //Getting a slice of users
    $builder = new Builder();
    if ('PSR' == $demande->type) {
        $builder->populatePersonsType($demande->start, $demande->maxEntries);
    }
    $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']);
    //Log the processing (because we can)
    $log = new Logger('IndexLog');
    $stream = new StreamHandler('log/indexer.log', Logger::DEBUG);
    $stream->setFormatter(new LineFormatter("%datetime% > %level_name% > %message%\n", "Y-m-d H:i:s"));
    $log->pushHandler($stream);
    $log->addDebug(sprintf("Indexing %s, slice %d/%d", $demande->type, $demande->start / $demande->maxEntries + 1, $demande->total / $demande->maxEntries + 1));
};
$channel->basic_qos(null, 1, null);
$channel->basic_consume('task_queue', '', false, false, false, false, $callback);
while (count($channel->callbacks)) {
    $channel->wait();
}
$channel->close();
開發者ID:egosselin1,項目名稱:esRabbitPhpGenerator,代碼行數:31,代碼來源:worker.php


注:本文中的Builder::populatePersonsType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。