GithubHelp home page GithubHelp logo

rybakit / phive-queue Goto Github PK

View Code? Open in Web Editor NEW
167.0 9.0 10.0 532 KB

$queue->push('I can be popped off after', '10 minutes');

License: MIT License

PHP 98.19% PLpgSQL 0.54% TSQL 1.27%
php queue pdo beanstalkd redis mongodb tarantool sysv scheduler

phive-queue's People

Contributors

rybakit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phive-queue's Issues

Is rabbitmq support feasible?

I have taken a cursory glance at the package, and my initial answer is "maybe", but since you are the author, you might have a better idea.

One potential issue is needing to handle exchange/routing_key/queue semantics, which I don't know if any of your drivers currently handle.

New feature: cancel scheduled job

I'm looking at existing PHP libraries for scheduling jobs at a given date or with a given delay. A requirement however is that a job that gets scheduled, can be cancelled later on. phive-queue looks great, but it currently lacks this feature.

Not all storage backends supported by phive-queue support cancelling queued items. To get this implemented, I think a second interface next to Queue will be needed. This interface might be called "CancellableQueue". Implementations that have cancel support can implement the additional methods of this new interface.
The unique identifier of a scheduled job could be returned by Queue::push(). Implementations that do not support job IDs can just return void. You could also leave Queue::push() alone, and add a new method getLastPushedId() that returns the ID of the last pushed job.

Are you interested in adopting this feature in phive-queue? My team probably can contribute interfaces and implementations for PDO and Beanstalkd.

Support for closures

The documentation does not mention anything about closures but it appears that those are supported by InMemoryQueue. Please consider the following scenario:

$queue = new InMemoryQueue();
$queue->push(function() { 
    return 'Example with closures'; 
});
$item = $queue->pop();
echo $item();

The above scenario is executed successfully, printing "Example with closures". Some other Queue Types may not support this directly, but we can serialise closures using jeremeamia/SuperClosure library.

Are there any plans to support closures?

Remove "count" from the Queue interface

Options:

  1. Remove count() method from queues

  2. Leave count() and add Countable interface:

class InMemoryQueue implements Queue, \Countable
{
    ...

    public function count()
    {
        ...
    }
}
  1. Put count() into separate interface:
interface AdvancedQueue extends Queue, \Countable
{
    public function slice($offset, $limit);
}

Add OuterQueue interface

interface OuterQueue extends Queue
{
    /**
     * @return Queue
     */
    public function getInnerQueue();
}

class TypeSafeQueue implements OuterQueue
{
    ...
}

or

interface QueueAware
{
    /**
     * @return Queue
     */
    public function getQueue();
}

class TypeSafeQueue implements Queue, QueueAware
{
    ...
}

Function Redis::evaluate() is deprecated

[2021-04-10T11:28:33+08:00][error] Type: ErrorException; Message: Function Redis::evaluate() is deprecated; File: C:\Users\Zsoner\Desktop\RaxChat\workerman\vendor\rybakit\phive-queue\src\RedisQueue.php; Line: 52;
#0 C:\Users\Zsoner\Desktop\RaxChat\workerman\vendor\rybakit\phive-queue\src\RedisQueue.php(52): log_error(8192, 'Function Redis:...', 'C:\Users\Zsoner...', 52, Array)
#1 C:\Users\Zsoner\Desktop\RaxChat\workerman\core\functions.php(412): Phive\Queue\RedisQueue->push('{"from":"100000...')
#2 C:\Users\Zsoner\Desktop\RaxChat\workerman\RaxChat\app\model\Message.php(281): addToQueue('insert_message', Array)
#3 C:\Users\Zsoner\Desktop\RaxChat\workerman\RaxChat\app\service\Joke.php(21):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.