如何在php中使用tarantool队列


How can i use tarantool queue in php?

有一个php库https://github.com/tarantool-php/queue,但它需要ext-tarantool,那么是否有任何纯用php编写的活动可维护库,允许我们在php5.6或7中使用tarantool队列?或者有没有现成的软件包可以让centos为php5.6安装ext-tarantool?yum install php-tarantool给出以下不兼容错误

Error: Package: php-tarantool-0.1.0-19.el6.x86_64 (tarantool_1_6)
          Requires: php(zend-abi) = 20090626
          Installed: php-common-5.6.19-1.el6.remi.x86_64 (@remi-php56)
              php(zend-abi) = 20131226-64

我是tarantool php/队列库的作者。我计划在未来添加对纯PHP Tarantool客户端的支持,只是还没有。免费填写以提交相关票据;)

同时,作为一种变通方法,您可以用'Tarantool类装饰Tarantool'Client,例如:

use Tarantool'Client;
class Tarantool
{
    private $client;
    public function __construct(Client $client)
    {
        $this->client = $client;
    }
    public function call($functionName, array $args = null)
    {
        $result = $this->client->call($functionName, $args ? $args : []);
        return $result->getData();
    }
}

然后像这样使用:

use Tarantool'Client;
use Tarantool'Connection'SocketConnection;
use Tarantool'Packer'PurePacker;
use Tarantool'Queue'Queue;
$client = new Client(new SocketConnection(), new PurePacker());
$client = new Tarantool($client);
$queue = new Queue($client, 'foobar');