A set of utility classes to help creating complex jobs for Tarantool JobQueue.
The recommended way to create a new application is through Composer:
composer require tarantool/jobbuilder
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);
vendor/bin/phpunit
The library is released under the MIT License. See the bundled LICENSE file for details.