tarantool / jobbuilder
A set of utility classes to help creating complex jobs for Tarantool JobQueue.
Fund package maintenance!
rybakit
Installs: 10 294
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: ^7.2.5|^8
- tarantool/queue: ^0.10
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpunit/phpunit: ^7.1|^8|^9
- vimeo/psalm: ^3.9|^4
This package is auto-updated.
Last update: 2024-11-11 23:53:20 UTC
README
A set of utility classes to help creating complex jobs for Tarantool JobQueue.
Installation
The recommended way to create a new application is through Composer:
composer require tarantool/jobbuilder
Usage
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);
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
vendor/bin/phpunit
License
The library is released under the MIT License. See the bundled LICENSE file for details.