You've already forked Php-Template
feat/queue-kafka (#15)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m26s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m8s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 59s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m14s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m16s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m13s
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m26s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m8s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 59s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m14s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m16s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m13s
Reviewed-on: #15 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
This commit was merged in pull request #15.
This commit is contained in:
@@ -6,6 +6,7 @@ namespace Siteworxpro\App\Cli\Commands\Queue;
|
||||
|
||||
use Ahc\Cli\Input\Command;
|
||||
use Siteworxpro\App\Async\Consumer;
|
||||
use Siteworxpro\App\Async\Messages\SayHelloMessage;
|
||||
use Siteworxpro\App\Cli\Commands\CommandInterface;
|
||||
|
||||
class Start extends Command implements CommandInterface
|
||||
@@ -13,14 +14,19 @@ class Start extends Command implements CommandInterface
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('queue:start', 'Start the queue consumer to process messages.');
|
||||
|
||||
$this->argument('[name]', 'Your name')
|
||||
->option('-g, --greet', 'Include a greeting message');
|
||||
$this->argument('[queues]', 'The name of the queue to consume from. ex. "first_queue,second_queue"');
|
||||
}
|
||||
|
||||
public function execute(): int
|
||||
{
|
||||
$consumer = new Consumer();
|
||||
$queues = [];
|
||||
if ($this->values()['queues'] !== null) {
|
||||
$queues = explode(',', $this->values()['queues']);
|
||||
}
|
||||
|
||||
SayHelloMessage::dispatch("hello from queue consumer!");
|
||||
|
||||
$consumer = new Consumer($queues);
|
||||
$consumer->start();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user