Home > Article > PHP Framework > Execute multiple queues using yii2-query
Using yii2-query to execute multiple queues examines everyone’s understanding of the yii2-queue library. Yes, it is a component, which means we can use yii2 Create a queue component in the queue, or you can create N queue components.
So when we want to deploy multiple yii2-queue queues in yii2 applications, it becomes deploying multiple yii2-queue components.
(Related tutorial recommendations: yii framework)
Suppose we now want to use two queues in our yii2 application, one is of file type and the other is of redis type , the configuration is as follows:
This is enough. Of course, for the use of these two components, the following form is required:
Yii::$app->queue1; Yii::$app->queue2;
This is the component Instructions.
When we want to call the worker to execute, we also need two commands on the command line.
php yii queue1/listen;// or queue1/run php yii queue2/listen;// or queue2/run
That’s it.
For more programming related content, please pay attention to the Programming Introduction column on the php Chinese website!
The above is the detailed content of Execute multiple queues using yii2-query. For more information, please follow other related articles on the PHP Chinese website!