TestMqExit.php 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Http\Api\Mq;
  4. use Illuminate\Console\Command;
  5. class TestMqExit extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. * php artisan test:mq.exit
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'test:mq.exit';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Command description';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. for ($i = 0; $i < 10; $i++) {
  37. Mq::publish('ai_translate', ['hello world']);
  38. }
  39. return 0;
  40. }
  41. }