Laravel Version
12
PHP Version
8.3
Database Driver & Version
MySQL 8
Description
The Illuminate\Bus\Dispatcher
class initiate the PendingBatch
and PendingChain
instances directly, instead of using the container to resolve them.
This makes impossible to extend and swap these classes.
Practical example:
- Having a multi-tenanted application, where each tenant has it's own queue (to mitigate noisy neighbour problem).
- It is possible to define a dynamic, tenant-aware queue for individual jobs, it is not easily possible to do for batches and chains.
- The developer has to specify the
->onQueue()
modifier for every instance of batches and chains, which can be unnecessarily verbose.
- If the framework would let the developer to re-bind the
PendingBatch
and/or PendingChain
instances, the dynamic queue resolution could be easily done in one place - inside the tenant aware
descendant class.
Steps To Reproduce
Any fresh Laravel instance