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 bury_on_reject option to Beanstalkd bridge #49652

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

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Mar 10, 2023

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Contains #59273.

This PR adds two improvements to the Beanstalkd bridge:

  1. Beanstalkd has the concept of "buried" jobs, which is a way of denoting that something has gone wrong while the consumer was processing the job. This PR adds a bury_on_reject option to bury rejected messages instead of deleting them, which is the current behavior. Since Symfony messenger's retry mechanism sends a new message for each retry and rejects the old one, it would create multiple buried jobs for each failed one. To avoid this issue a SentForRetryStamp was added to identify whether a failed message was sent for retry or not. As long as the retry mechanism keeps sending a new message, the old one will be deleted. Once it finishes, the final rejected message will be buried.

    framework:
        messenger:
            transports:
                some_name:
                    dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                    options:
                        bury_on_reject: true
  2. Extracted to [Messenger] Add BeanstalkdPriorityStamp to Beanstalkd bridge #59273

@carsonbot carsonbot added this to the 6.3 milestone Mar 10, 2023
@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from d27f62e to 3243a9f Compare March 10, 2023 13:18
@HypeMC HypeMC changed the title [Messenger] Add bury_on_reject option to Beanstalkd bridge [Messenger] Add priority and bury_on_reject options to Beanstalkd bridge Mar 10, 2023
@HypeMC HypeMC closed this Mar 11, 2023
@HypeMC HypeMC reopened this Mar 12, 2023
@HypeMC HypeMC changed the title [Messenger] Add priority and bury_on_reject options to Beanstalkd bridge [Messenger] Add bury_on_reject option and BeanstalkdPriorityStamp to Beanstalkd bridge Mar 12, 2023
@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from 17fbade to ee0db6a Compare March 15, 2023 02:18
@nicolas-grekas nicolas-grekas modified the milestones: 6.3, 6.4 May 23, 2023
@spideyfusion
Copy link

@X-Coder264 Could you please give this a glance since you originally worked on this transport implementation?

Copy link
Contributor

@X-Coder264 X-Coder264 left a comment

Choose a reason for hiding this comment

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

@spideyfusion The implementation looks good to me 👍

@HypeMC HypeMC force-pushed the bury-on-reject branch 3 times, most recently from 235b83f to 669a8bf Compare September 5, 2023 19:32
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
@OskarStark OskarStark force-pushed the bury-on-reject branch 2 times, most recently from c6ec2c9 to 64e02ec Compare December 29, 2023 22:28
@OskarStark
Copy link
Contributor

rebased ✅

@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from f933998 to 7987d87 Compare April 9, 2024 19:56
@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from a340de0 to c66a791 Compare April 9, 2024 20:19
@xabbuh xabbuh modified the milestones: 7.1, 7.2 May 15, 2024
@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from 6a9a57c to 9197b0b Compare August 11, 2024 14:03
@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
@HypeMC HypeMC changed the title [Messenger] Add bury_on_reject option and BeanstalkdPriorityStamp to Beanstalkd bridge [Messenger] Add bury_on_reject option to Beanstalkd bridge Dec 20, 2024
@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from b706a44 to 4ca177e Compare December 20, 2024 19:26
fabpot added a commit that referenced this pull request Jan 5, 2025
…d bridge (HypeMC)

This PR was merged into the 7.3 branch.

Discussion
----------

[Messenger] Add `BeanstalkdPriorityStamp` to Beanstalkd bridge

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

Extracted from #49652 as the original PR was trying to do two separate things in one.

Beanstalkd has the ability to configure the priority at which messages are reserved. This can now be set using the `BeanstalkdPriorityStamp`:

```php
$this->bus->dispatch(new SomeMessage('some data'), [
    new BeanstalkdPriorityStamp(0),
]);
```

Commits
-------

9926d59 [Messenger] Add BeanstalkdPriorityStamp to Beanstalkd bridge
@fabpot
Copy link
Member

fabpot commented Jan 5, 2025

@HypeMC Now that #59273 has been merged, this one can be rebased. Thank you.

@HypeMC
Copy link
Contributor Author

HypeMC commented Jan 6, 2025

@HypeMC Now that #59273 has been merged, this one can be rebased. Thank you.

@fabpot Done

@HypeMC HypeMC force-pushed the bury-on-reject branch 2 times, most recently from 2824fcb to bc7dc5d Compare January 27, 2025 02:04
@fabpot
Copy link
Member

fabpot commented Feb 7, 2025

Thank you @HypeMC.

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.

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