Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

The Dispatcher class does not use the container to resolve the PendingBatch and PendingChain instances #57402

Copy link
Copy link
@sebestenyb

Description

@sebestenyb
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.