Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,65 @@ Install

$ composer require visual-craft/work-queue-bundle

Configure
-------
```yaml
##config/packages/visual_craft_work_queue.yaml

visual_craft_work_queue:
connections:
default: ~
queues:
test_queue:
connection: default
worker: 'App\BackgroundJob\Worker\TestWorker'
```

Create Worker
-------
```php
<?php

declare(strict_types=1);

namespace App\BackgroundJob\Worker;

use VisualCraft\WorkQueue\Worker\JobMetadata;
use VisualCraft\WorkQueue\Worker\WorkerInterface;

class TestWorker implements WorkerInterface
{
public function work($payload, JobMetadata $metadata): void
{
//..
}
}
```

Add service
-------
```yaml
services:
App\Command\TestCommand:
arguments:
- '@visual_craft_work_queue.manager.test_queue'
```

Add queue
-------
```php
//..
private QueueManager $queueManager;

public function __construct(QueueManager $queueManager)
{
$this->queueManager = $queueManager;
}

//..
$this->queueManager->add('mixed payload');
//..
```
License
-------

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
},
"require": {
"php": ">=7.4.0",
"symfony/framework-bundle": "~5.0",
"symfony/monolog-bundle": "~3.5",
"symfony/console": "~5.0",
"symfony/framework-bundle": "^5.0|^6.0",
"symfony/monolog-bundle": "^3.5",
"symfony/console": "^5.0|^6.0",
"visual-craft/work-queue": "^0.1.0"
}
}