gonzalo123/zmqlifo

LIFO Queue with ZeroMQ

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

This package is not auto-updated.

Last update: 2024-12-07 15:32:28 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();