-
Notifications
You must be signed in to change notification settings - Fork 424
pass dispatchAfterCommit into custom worker constructor #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
align constructors for custom workers and RabbitMQQueue
I believe the intention for this was for custom workers to extend Queue and implement QueueContract. That being said, it is a good idea to make those calls consistent. |
Hi @M-Porter we added some tracing into RabbitMQQueue by inheriting it and incompatible constructor make things clumsy |
In its current form, this would be a breaking change and will therefore have to wait on a major version release. |
@khepin well, 13.0.2 also introduces incompatibility with some versions of laravel 9 |
@khepin what if there will be some new option
this will allow to have fix without introduction of breaking changes |
Does this work ????
<?php
namespace App\Queue;
use Illuminate\Support\Arr;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
class CustomRabbitMQQueue extends RabbitMQQueue
{
public function __construct(
AbstractConnection $connection,
string $default,
array $options = []
) {
$dispatchAfterCommit = Arr::pull($options, 'after_commit', false);
parent::__construct($connection, $default, $dispatchAfterCommit, $options);
} and in the connection config ( move the #/config/queue.php
'connections' => [
// ...
'rabbitmq' => [
// ...
// 'after_commit' => true
'options' => [
'queue' => [
// ...
'after_commit' => true
'job' => \App\Queue\Jobs\RabbitMQJob::class,
],
],
],
// ... |
@khepin When If people are depending on the constructor of the RabibitMQQueue:class, people had already noticed issues and had to correct this with a sort of sollution I presented above. |
Hi @adm-bome |
Not really, if you want to replace all classes then use a fork or write your own implementation of a driver 😄 The contructors calls must align with the default constructor of RabibitMQQueue:class. As i mentioned above |
Closing this, because the connector was refactored and the Factory uses a different approach for the constructor (one single config object) |
align constructors for custom workers and RabbitMQQueue
so there no need to map somehow constructor in case of custom worker