Queueable.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. namespace think\queue;
  12. trait Queueable
  13. {
  14. /** @var string 连接 */
  15. public $connection;
  16. /** @var string 队列名称 */
  17. public $queue;
  18. /** @var integer 延迟时间 */
  19. public $delay;
  20. /**
  21. * 设置连接名
  22. * @param $connection
  23. * @return $this
  24. */
  25. public function onConnection($connection)
  26. {
  27. $this->connection = $connection;
  28. return $this;
  29. }
  30. /**
  31. * 设置队列名
  32. * @param $queue
  33. * @return $this
  34. */
  35. public function onQueue($queue)
  36. {
  37. $this->queue = $queue;
  38. return $this;
  39. }
  40. /**
  41. * 设置延迟时间
  42. * @param $delay
  43. * @return $this
  44. */
  45. public function delay($delay)
  46. {
  47. $this->delay = $delay;
  48. return $this;
  49. }
  50. }