https://github.com/tarantool-php/jobbuilder
A set of utility classes to help creating complex jobs for Tarantool JobQueue.
https://github.com/tarantool-php/jobbuilder
job-builder jobqueue nosql priority-queue queue scheduler worker
Last synced: 10 months ago
JSON representation
A set of utility classes to help creating complex jobs for Tarantool JobQueue.
- Host: GitHub
- URL: https://github.com/tarantool-php/jobbuilder
- Owner: tarantool-php
- License: mit
- Created: 2019-03-01T17:19:16.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-11T19:29:53.000Z (over 3 years ago)
- Last Synced: 2025-03-05T19:16:44.836Z (11 months ago)
- Topics: job-builder, jobqueue, nosql, priority-queue, queue, scheduler, worker
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# JobBuilder
[](https://github.com/tarantool-php/jobbuilder/actions?query=workflow%3AQA)
[](https://t.me/tarantool_php)
A set of utility classes to help creating complex jobs for [Tarantool JobQueue](https://github.com/tarantool-php/jobqueue).
## Installation
The recommended way to create a new application is through [Composer](http://getcomposer.org):
```sh
composer require tarantool/jobbuilder
```
## Usage
```php
use Tarantool\JobQueue\JobBuilder\JobBuilder;
...
$task = JobBuilder::fromService('service_foo', ['bar', 'baz'])
->withServiceMethod('qux')
->withConstantBackoff()
->withMaxRetries(3)
->withRecurrenceIntervalSeconds(600)
->withTimeToLiveSeconds(300)
->withTimeToRunSeconds(180)
->withPriority(4)
->withDelaySeconds(60)
->withTube('foobar')
->putTo($queue);
```
```php
use App\Job\MyJob\MyJobHandler;
use Tarantool\JobQueue\JobBuilder\JobBuilder;
use Tarantool\JobQueue\JobBuilder\JobEmitter;
...
$jobBuilders = (static function () use ($ids) {
foreach ($ids as $id) {
yield JobBuilder::fromService(MyJobHandler::class, ['id' => $id]);
}
})();
(new JobEmitter())->emit($jobBuilders, $queue);
```
## Tests
```bash
vendor/bin/phpunit
```
## License
The library is released under the MIT License. See the bundled [LICENSE](LICENSE) file for details.