himedia / php-pzq-api
API for PZQ, a persistent store daemon by Mikko Koppanen which uses the ZeroMQ messaging socket library.
Requires
- php: >=5.3.2
This package is not auto-updated.
Last update: 2024-11-19 07:10:12 UTC
README
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.
Installing via Composer
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';
Usage
Consumer usage
$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);
Producer usage
$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); }
Monitor usage
$m = new \HIM\PZQ\Monitor("ipc:///tmp/pzq-monitor"); var_dump($m->getStats());
Copyrights & licensing
Licensed under the GNU Lesser General Public License v3 (LGPL version 3). See LICENSE file for details.
Change log
See CHANGELOG file for details.
Git branching model
The git branching model used for development is the one described and assisted by twgit
tool: https://github.com/Twenga/twgit.