Skip to content

Navigation Menu

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

[Messenger] Add --class-filter option to the messenger:failed:remove command #59978

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

arnaud-deabreu
Copy link
Contributor

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

This PR adds the --class-filter to the messenger:failed:remove command which is already available on messenger:failed:show command.
It will yield the message ids that match the given class and use it as if it were passed as the id argument in the command so the --force and --show-messages can work with this filter.
When using the filter, the command will prompt for confirmation before removing the messages.

Example output:

$ bin/console messenger:failed:remove --class-filter="App\Message\MyMessage"

 There is 16 messages to remove. Do you want to continue? (yes/no) [yes]:

@carsonbot carsonbot added this to the 7.3 milestone Mar 14, 2025
@arnaud-deabreu arnaud-deabreu force-pushed the feature/messenger-delete-failed-message-by-class-filter branch from 15bd310 to 8557685 Compare March 15, 2025 07:44
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@OskarStark
Copy link
Contributor

class-filter sounds to much technical to me. What about message-filter ?

@chalasr
Copy link
Member

chalasr commented Mar 24, 2025

@OskarStark message-filter seems too broad to me. Also class-filter is inline with what exists in FailedMessagesShowCommand

@arnaud-deabreu arnaud-deabreu force-pushed the feature/messenger-delete-failed-message-by-class-filter branch from be6573e to fae8ce5 Compare March 24, 2025 07:27
throw new RuntimeException('No failed messages were found with this filter.');
}

if (!$io->confirm(\sprintf('There is %d message%s to remove. Do you want to continue?', $idsCount, $idsCount > 1 ? 's' : ''))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid using is or are depending on the number of messages, let's rewrite it to something like:

Suggested change
if (!$io->confirm(\sprintf('There is %d message%s to remove. Do you want to continue?', $idsCount, $idsCount > 1 ? 's' : ''))) {
if (!$io->confirm(\sprintf('Can you confirm you want to remove %d message%s?', $idsCount, 1 === $idsCount ? '' : 's'))) {

@fabpot fabpot force-pushed the feature/messenger-delete-failed-message-by-class-filter branch from fae8ce5 to 1924719 Compare March 24, 2025 08:02
@fabpot
Copy link
Member

fabpot commented Mar 24, 2025

Thank you @arnaud-deabreu.

@fabpot fabpot merged commit 322995c into symfony:7.3 Mar 24, 2025
3 of 11 checks passed
@xabbuh xabbuh mentioned this pull request Mar 24, 2025
xabbuh added a commit that referenced this pull request Mar 24, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[Messenger] fix test

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | related to #59978 (comment)
| License       | MIT

Commits
-------

0ec778b fix test
OskarStark added a commit to symfony/symfony-docs that referenced this pull request Mar 24, 2025
…ger:failed:remove` command (arnaud-deabreu)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[Messenger] Add `--class-filter` option to the `messenger:failed:remove` command

| Q             | A
| ------------- | ---
| Feature PR |	symfony/symfony#59978
| PR author(s) | `@arnaud`-deabreu
| Merged in | 7.3
| Doc issue | Fix #20805

The `--class-filter` was added in the `messenger:failed:remove` command in this [PR](symfony/symfony#59978).
As the option already exists in the `messenger:failed:show` I'm wondering if only adding this example could be enough ?

Commits
-------

bdca4e9 [Messenger] Add `--class-filter` option to the `messenger:failed:remove` command
@fabpot fabpot mentioned this pull request May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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