gonzalo123/zmqlifo

LIFO Queue with ZeroMQ

Installs: 53

Dependents: 0

Stars: 6

Watchers: 2

Forks: 3

Language: PHP

dev-master 2013-06-24 12:47 UTC

README

Build Status

ZeroMQ LIFO Queue

usage examples:

Client:

<?php
include __DIR__ . '/../vendor/autoload.php';

use Zmqlifo\Client;

$queue = Client::factory('tcp://127.0.0.1:4444');
echo $queue->run("ls -latr")->getOutput();
echo $queue->run("pwd")->getOutput();

Server

<?php
include __DIR__ . '/../vendor/autoload.php';

use Symfony\Component\Process\Process;
use Zmqlifo\Server;

$server = Server::factory('tcp://127.0.0.1:4444');
$server->registerOnMessageCallback(function ($msg) {
    $process = new Process($msg);
    $process->setTimeout(3600);
    $process->run();
    return $process->getOutput();
});

$server->run();