-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide queue component #492
Comments
Another implementation might be based on System V message queues if PHP was compiled with |
the local thing may use http://de2.php.net/manual/en/class.splqueue.php |
I really agree with this one. |
A bit detalized proposal and architecture: https://gist.github.com/resurtm/5723626 |
I've tried to implement it here https://github.com/yupe/yupe/tree/master/protected/modules/queue/components |
That will be really great. Take a look at https://developers.google.com/appengine/docs/php/taskqueue/. |
I almost finished a queue interface with three implementations that I'd like to propose as a base for work on queue components for Yii2. I got:
Should I make a WIP labeled PR or just make a branch and reference it here? The current code is in my Yii 1 nfy module repo. I am going to port the whole module to Yii 2. There still are some issues to discuss about the current implementation. |
PR is better. |
@samdark what is the queue component actually doing? (Besides adding/removing jobs from the queue.) Is it responsible for polling the queue and invoking callbacks as well? Maybe I'm way off on the intended use-case, which to me is more like a glorified cache or db store: public function uploadImage($uploadedImage)
{
// Perform necessary stuff synchronously
if (false === ($filename = $uploadedImage->save())) {
return false;
}
// Perform time-consuming stuff asynchronously
// Queue only stores the message. Listeners are responsible for processing them.
Yii::$app->queue->add(new CreateThumbnailsTask($filename));
return true;
} If we're just defining an interface, why stop with push/pull? There are a lot of methods we might want to implement. |
@danschmidt5189 I'm working on a general interface for a message queue that can be used to provide a job queue. I'm going to post a PR in very short time for review. Such interface will come with few implementations to assist communication between concurrent requests. While working on it I considered creating an implementation that uses cache interface provided by the framework but found it very limiting. That validates the need for a message queue component in the framework or as a core extension. |
http://kr.github.io/beanstalkd/ is good solution for small-medium size projects. Has full control on tubes and tasks, really fast. |
+1 if this can support concurrent/parallel jobs Just a hint on possible implementation details: |
It's now managed in https://github.com/yiisoft/yii2-queue |
@nineinchnick check what's there first. |
Useful for background jobs and all projects processing relatively large amounts of data.
Implementation can be designed the same way as cache i.e. base API + drivers such as:
Proposed base API:
The text was updated successfully, but these errors were encountered: