Skip to content

PHP API for PZQ, a persistent store daemon by Mikko Koppanen which uses the ZeroMQ messaging socket library.

License

Notifications You must be signed in to change notification settings

Hi-Media/php-pzq-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-pzq-api

PHP API for PZQ, a persistent store daemon by Mikko Koppanen which uses the ZeroMQ messaging socket library.

Latest stable version

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.

About

PHP API for PZQ, a persistent store daemon by Mikko Koppanen which uses the ZeroMQ messaging socket library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages