This service helps you to communicate between services
composer require spatie/laravel-signal-aware-command
composer require mohsenbagheri/kamui
php artisan vendor:publish
php artisan migrate
routes/Web.php
Route::get('publish', [\App\Http\Controllers\TestController::class, 'publish'])->name('publish');
Route::get('subscribe', [\App\Http\Controllers\TestController::class, 'subscribe'])->name('subscribe');
controller
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Log;
use Mohsenbagheri\Kamui\Services\Communication\CommunicateRedisService;
class TestController extends Controller
{
public function __construct(private CommunicateRedisService $communicateRedisService)
{
}
public function publish()
{
$this->communicateRedisService->send('test', ['message' => 'hello world!']);
return 'ok';
}
public function subscribe(object $data)
{
Log::info("data", $data);
}
}
command console
php artisan worker:redis test subscribe
or
php artisan worker:rabbitmq test subscribe
#Grpc
Coming soon!