2017 © Pedro Peláez
 

library okq

A PHP driver for the okq persistent queue

image

mc0/okq

A PHP driver for the okq persistent queue

  • Saturday, February 27, 2016
  • by mc0
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

okq-php

A PHP driver for the okq persistent queue., (*1)

okq uses the redis protocol and calling conventions as it's interface, so any standard redis client can be used to interact with it. This package wraps around a normal redis driver, however, to provide a convenient interface to interact with. Specifically, it creates a simple interface for event consumers to use so they retrieve events through a channel rather than implementing that logic manually every time., (*2)

Usage

Commands for okQ are implemented on the Okq class parameters resemble those of the okQ command itself. The Okq class extends phpredis/Redis and can be constructed using the same arguments:, (*3)

$q = new Okq();
$q->connect('127.0.0.1', 4777);

Then to add jobs you just run the command!, (*4)

$event = array('test' => 1);
$eventId = '233'; // this can also be null and will be generated
$success = $q->qlpush('testQueue', json_encode($event), $eventId);

If you're a consumer you can just use the convenience consume method., (*5)

/* the $callback can be any callable:
 - array('StaticClass', 'funcName')
 - array($obj, 'funcName')
 - 'funcName'
 - create_function('$event', '...')
*/
$callback = function ($event) use ($q) {
    // do anything or nothing at all
    return Okq::EVENT_ACK;
};
$timeout = 30;
$q->consume($callback, array('testQueue'), $timeout);

The Versions

27/02 2016

dev-master

9999999-dev

A PHP driver for the okq persistent queue

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

redis queue okq