Skip to content

A set of utility classes to help creating complex jobs for Tarantool JobQueue.

License

Notifications You must be signed in to change notification settings

tarantool-php/jobbuilder

Repository files navigation

JobBuilder

Quality Assurance Telegram

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.

About

A set of utility classes to help creating complex jobs for Tarantool JobQueue.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages