PHP API for PZQ, a persistent store daemon by Mikko Koppanen which uses the ZeroMQ messaging socket library.
This is an implementation from the php-api provided by @mkoppanen.
The recommended way to install PHP PZQ API is through Composer.
### Install Composer
curl -sS https://getcomposer.org/installer | php
Next, update your project's composer.json file to include:
{
"require": {
"himedia/php-pzq-api": "1.*"
}
}
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
$context = new \ZMQContext();
$consumer = new \HIM\PZQ\Consumer($context, "tcp://127.0.0.1:11132");
$ids = array();
for ($i = 0; $i < 10000; $i++) {
$message = $consumer->consume();
$consumer->ack($message);
echo "Consumed {$i}" . PHP_EOL;
}
sleep (5);
$context = new \ZMQContext();
$producer = new \HIM\PZQ\Producer("tcp://127.0.0.1:11131");
$producer->setIgnoreAck(false);
for ($i = 0; $i < 10000; $i++) {
$message = new \HIM\PZQ\Message();
$message->setId("id-{$i}");
$message->setMessage("id-{$i}");
//echo "Produced id-{$i}" . PHP_EOL;
$producer->produce($message, 10000);
}
$m = new \HIM\PZQ\Monitor("ipc:///tmp/pzq-monitor");
var_dump($m->getStats());
Licensed under the GNU Lesser General Public License v3 (LGPL version 3). See LICENSE file for details.
See CHANGELOG file for details.
The git branching model used for development is the one described and assisted by twgit
tool: https://github.com/Twenga/twgit.