queue.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: yunwuxin <448901948@qq.com>
  10. // +----------------------------------------------------------------------
  11. use think\facade\Env;
  12. return [
  13. // 内置驱动:redis、database、topthink、sync
  14. 'default' => 'redis', // sync驱动表示取消消息队列还原为同步执行
  15. 'connections' => [
  16. 'sync' => [
  17. 'type' => 'sync',
  18. ],
  19. 'database' => [
  20. 'type' => 'database',
  21. 'queue' => '',
  22. 'table' => 'jobs',
  23. 'connection' => null,
  24. ],
  25. 'redis' => [
  26. 'type' => 'redis',
  27. // 默认队列名称
  28. 'queue' => 'default',
  29. // 服务器地址
  30. 'host' => Env::get('redis.host', '127.0.0.1'),
  31. // 端口号
  32. 'port' => Env::get('redis.port', '6379'),
  33. // 密码
  34. 'password' => Env::get('redis.passwd', 'keli123456'),
  35. // 索引库
  36. 'select' => 0,
  37. // 连接超时
  38. 'timeout' => 0,
  39. // 是否长连接
  40. 'persistent' => false,
  41. ],
  42. ],
  43. 'failed' => [
  44. 'type' => 'none',
  45. 'table' => 'failed_jobs',
  46. ],
  47. ];