Skip to content

Conversation

OskarStark
Copy link
Contributor

@OskarStark OskarStark commented Jul 1, 2025

  • Add documentation for the new --exclude-receivers option
  • Show usage example with --all flag
  • Include version annotation for Symfony 7.4
  • Add note about requirement to use with --all option

Code PR

@carsonbot carsonbot added this to the 7.4 milestone Jul 1, 2025
…mand

- Add documentation for the new `--exclude-receivers` option
- Show usage example with `--all` flag
- Include version annotation for Symfony 7.4
- Add note about requirement to use with `--all`
@OskarStark OskarStark force-pushed the document-messenger-exclude-receivers branch from a231811 to c0c553c Compare July 1, 2025 08:07
@OskarStark OskarStark changed the title Document the --exclude-receivers option for messenger:consume command Document the --exclude-receivers option for messenger:consume command Jul 1, 2025
@javiereguiluz javiereguiluz added Waiting Code Merge Docs for features pending to be merged Messenger labels Jul 4, 2025
@carsonbot carsonbot changed the title Document the --exclude-receivers option for messenger:consume command [Messenger] Document the --exclude-receivers option for messenger:consume command Jul 4, 2025
@carsonbot carsonbot modified the milestones: 7.4, next Jul 4, 2025
fabpot added a commit to symfony/symfony that referenced this pull request Aug 23, 2025
…nsume` command (jbdelhommeau)

This PR was merged into the 7.4 branch.

Discussion
----------

[Messenger] Add `--exclude-receivers` to `messenger:consume` command

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Docs          | symfony/symfony-docs#21165
| License       | MIT

This PR adds a new `--exclude-receivers` (shortcut `-et`) option to the `messenger:consume` command. This option allows users to exclude specific transports/receivers from being consumed when using the `--all` flag.

**What it does and why it's needed:**
- When running `messenger:consume --all`, you may want to skip certain transports (example the failed transports) without having to list all the others manually. The new `--exclude-receivers` option makes this possible.
- This improves flexibility and usability for complex Messenger setups.

**How it works:**
```bash
php bin/console messenger:consume --all --exclude-receivers=queues1 --exclude-receivers=queues2
```
This will consume messages from all transports except `queues1` and `queues2`.

**Behavior:**
- The `--exclude-queues` option can only be used with `--all`. If used without `--all`, an `InvalidOptionException` is thrown.
- If all queues are excluded, a `RuntimeException` is thrown to prevent running the command with no receivers.

**Before:**
- No way to exclude specific receivers when using `--all`.

**After:**
- You can now exclude queues with `--exclude-receivers` when using `--all`.

**Tests:**
- Unit tests have been added to cover the new option, its validation, and edge cases.

Commits
-------

9d9a9d8 chore: add exclude-receivers consume parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Messenger Status: Needs Review Waiting Code Merge Docs for features pending to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants