laravel-rabbitmq/README.md

66 lines
977 B
Markdown

# Install
You should change the /src/.env.example file name to .env and run
```
docker network create consumer
docker compose up rabbitmq socketio -d
```
# Clone CONSUMER container
.env
```
VERSION=1
```
run
```
docker compose up consumer -d
```
laravel-rabbitmq{VERSION}
```
laravel-rabbitmq1
```
# Monitor
Rabbitmq: rabbit/rabbit123
```
http://localhost:15672
```
# Test
Run job on website
```
http://localhost:8000/terminal
```
Job: producer/app/Console/Commands/JobRun.php
```
artisan job:run
```
code
```php
use Illuminate\Support\Facades\Queue;
Queue::connection('rabbitmq')
->push(
job: 'not_laravel',
queue: 'puppeteer',
data: [
'url' => env('PUPPETEER_URL'),
],
);
```
# Log
> [!NOTE]
>
> `-f`: file <br>
> `--tail 10`: Watch only see the last 10 lines
View log `app`
```
docker logs -f --tail 10 laravel-rabbitmq1-app-1
```
View log `puppeteer`
```
docker logs -f --tail 10 laravel-rabbitmq1-puppeteer-1
```