The Dispatcher class does not use the container to resolve the PendingBatch and PendingChain instances #57485
Unanswered
sebestenyb
asked this question in
Ideas
Replies: 1 comment
-
public function register()
{
$this->app->singleton(Dispatcher::class, function ($app) {
return new Dispatcher($app, function ($connection = null) use ($app) {
return $app[QueueFactoryContract::class]->connection($connection);
});
});if you can replace \Illuminate\Bus\BusServiceProvider and register a child class for Dispatcher you can overwrite in that child the methods you are trying to change in your PR. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
12
PHP Version
8.3
Database Driver & Version
MySQL 8
Description
The
Illuminate\Bus\Dispatcherclass initiate thePendingBatchandPendingChaininstances directly, instead of using the container to resolve them.This makes impossible to extend and swap these classes.
Practical example:
->onQueue()modifier for every instance of batches and chains, which can be unnecessarily verbose.PendingBatchand/orPendingChaininstances, the dynamic queue resolution could be easily done in one place - inside the tenant awaredescendant class.
Steps To Reproduce
Any fresh Laravel instance
Beta Was this translation helpful? Give feedback.
All reactions