douhuo0884 2018-08-16 19:22
浏览 117

生成为Laravel作业队列创建表的迁移?

I'm trying to set up a table in order to asynchronously execute jobs in Laravel. I've already written the job class and can dispatch it. However it is dispatching synchronously.

Following the documentation When I attempt to create the migration with php artisan queue:table I receive the following error:

[Symfony\Component\Console\Exception\CommandNotFoundException]     
Command "queue:table" is not defined.                             
Did you mean one of these?                                      
queue:failed                                                
queue:work                                                  
queue:restart                                               
queue:listen                                                
queue:retry                                                 
queue:forget                                                
queue:flush

I noticed I didn't initially have a queue.php file in the config directory so I added the one from the repository and changed 'default' => env('QUEUE_DRIVER', 'sync') to 'default' => env('QUEUE_DRIVER', 'database'),;

I also changed QUEUE_DRIVER=sync to QUEUE_DRIVER=database in my .env file.

I'm new to job queues in Laravel so I'm not sure what I'm missing. How can I create the migration to utilize the database queue driver?

UPDATE: I wound up just creating a jobs table in the postgres db I'm using for the rest of my data following the structure described in the Lumen documentation and using that to store jobs but still curious why the queue:table function isn't available.

Laravel Framework version Lumen (5.3.3) (Laravel Components 5.3.*)

  • 写回答

1条回答 默认 最新

  • duanmeng7865 2019-03-27 12:35
    关注
    php artisan queue:table 
    

    this command is right but set the QUEUE_DRIVER=database in .env file and also check that in job

    class TempleteEmailJob implements ShouldQueue
    

    implements ShouldQueue is required for create migration

    and then php artisan migrate

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)