spiral / roadrunner-bridge

🌉 RoadRunner bridge to Spiral Framework
https://spiral.dev/docs/packages-roadrunner-bridge
MIT License
14 stars 7 forks source link

Adding the ability to configure priority and autoAck #28

Closed msmakouz closed 2 years ago

msmakouz commented 2 years ago

This PR adds the ability to configure the priority and autoAck parameters in the Options from the roadrunner-jobs package:

https://github.com/spiral/roadrunner-jobs/blob/master/src/Options.php#L24 https://github.com/spiral/roadrunner-jobs/blob/master/src/Options.php#L29

Example:

namespace App\Controller;

use App\Job\Ping;
use Spiral\Queue\QueueInterface;
use Spiral\RoadRunnerBridge\Queue\Options;

class HomeController
{
    public function __construct(
        private readonly QueueInterface $queue,
    ) {
    }

    public function ping(): string
    {
        $jobID = $this->queue->push(Ping::class, [
            'value' => 'hello world',
        ], (new Options())->withPriority(4)->autoAck()->withDelay(5));

        return sprintf('Job ID: %s', $jobID);
    }
}
codecov[bot] commented 2 years ago

Codecov Report

Merging #28 (bcec31c) into 2.0 (d3b6e3c) will increase coverage by 0.42%. The diff coverage is 95.23%.

@@             Coverage Diff              @@
##                2.0      #28      +/-   ##
============================================
+ Coverage     87.50%   87.92%   +0.42%     
- Complexity      199      204       +5     
============================================
  Files            39       40       +1     
  Lines           512      530      +18     
============================================
+ Hits            448      466      +18     
  Misses           64       64              
Impacted Files Coverage Δ
src/Queue/Dispatcher.php 70.83% <0.00%> (ø)
src/Queue/Options.php 100.00% <100.00%> (ø)
src/Queue/Queue.php 87.50% <100.00%> (+4.16%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.